This source file includes following definitions.
- preamble
- throwException
#include "config.h"
#include "core/dom/custom/CustomElementException.h"
#include "bindings/v8/ExceptionState.h"
#include "core/dom/ExceptionCode.h"
namespace WebCore {
String CustomElementException::preamble(const AtomicString& type)
{
return "Registration failed for type '" + type + "'. ";
}
void CustomElementException::throwException(Reason reason, const AtomicString& type, ExceptionState& exceptionState)
{
switch (reason) {
case CannotRegisterFromExtension:
exceptionState.throwDOMException(NotSupportedError, preamble(type) + "Elements cannot be registered from extensions.");
return;
case ConstructorPropertyNotConfigurable:
exceptionState.throwDOMException(NotSupportedError, preamble(type) + "Prototype constructor property is not configurable.");
return;
case ContextDestroyedCheckingPrototype:
exceptionState.throwDOMException(InvalidStateError, preamble(type) + "The context is no longer valid.");
return;
case ContextDestroyedCreatingCallbacks:
exceptionState.throwDOMException(InvalidStateError, preamble(type) + "The context is no longer valid.");
return;
case ContextDestroyedRegisteringDefinition:
exceptionState.throwDOMException(NotSupportedError, preamble(type) + "The context is no longer valid.");
return;
case ExtendsIsInvalidName:
exceptionState.throwDOMException(NotSupportedError, preamble(type) + "The tag name specified in 'extends' is not a valid tag name.");
return;
case ExtendsIsCustomElementName:
exceptionState.throwDOMException(NotSupportedError, preamble(type) + "The tag name specified in 'extends' is a custom element name. Use inheritance instead.");
return;
case InvalidName:
exceptionState.throwDOMException(SyntaxError, preamble(type) + "The type name is invalid.");
return;
case PrototypeInUse:
exceptionState.throwDOMException(NotSupportedError, preamble(type) + "The prototype is already in-use as an interface prototype object.");
return;
case PrototypeNotAnObject:
exceptionState.throwDOMException(NotSupportedError, preamble(type) + "The prototype option is not an object.");
return;
case TypeAlreadyRegistered:
exceptionState.throwDOMException(NotSupportedError, preamble(type) + "A type with that name is already registered.");
return;
}
ASSERT_NOT_REACHED();
}
}