ExceptionHelpers.h [plain text]
#ifndef ExceptionHelpers_h
#define ExceptionHelpers_h
#include "ErrorInstance.h"
#include "JSObject.h"
namespace JSC {
typedef JSObject* (*ErrorFactory)(ExecState*, const String&, ErrorInstance::SourceAppender);
JSObject* createTerminatedExecutionException(VM*);
JS_EXPORT_PRIVATE bool isTerminatedExecutionException(Exception*);
JS_EXPORT_PRIVATE JSObject* createError(ExecState*, JSValue, const String&, ErrorInstance::SourceAppender);
JS_EXPORT_PRIVATE JSObject* createStackOverflowError(ExecState*);
JSObject* createUndefinedVariableError(ExecState*, const Identifier&);
JSObject* createNotAnObjectError(ExecState*, JSValue);
JSObject* createInvalidFunctionApplyParameterError(ExecState*, JSValue);
JSObject* createInvalidInParameterError(ExecState*, JSValue);
JSObject* createInvalidInstanceofParameterError(ExecState*, JSValue);
JSObject* createNotAConstructorError(ExecState*, JSValue);
JSObject* createNotAFunctionError(ExecState*, JSValue);
JSObject* createErrorForInvalidGlobalAssignment(ExecState*, const String&);
JSString* errorDescriptionForValue(ExecState*, JSValue);
JS_EXPORT_PRIVATE JSObject* throwOutOfMemoryError(ExecState*);
JS_EXPORT_PRIVATE JSObject* throwStackOverflowError(ExecState*);
JS_EXPORT_PRIVATE JSObject* throwTerminatedExecutionException(ExecState*);
class TerminatedExecutionError final : public JSNonFinalObject {
public:
typedef JSNonFinalObject Base;
static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal;
static TerminatedExecutionError* create(VM& vm)
{
TerminatedExecutionError* error = new (NotNull, allocateCell<TerminatedExecutionError>(vm.heap)) TerminatedExecutionError(vm);
error->finishCreation(vm);
return error;
}
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
{
return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
}
DECLARE_EXPORT_INFO;
private:
explicit TerminatedExecutionError(VM& vm)
: JSNonFinalObject(vm, vm.terminatedExecutionErrorStructure.get())
{
}
static JSValue defaultValue(const JSObject*, ExecState*, PreferredPrimitiveType);
};
}
#endif // ExceptionHelpers_h