#ifndef V8ThrowException_h
#define V8ThrowException_h
#include "wtf/text/WTFString.h"
#include <v8.h>
namespace WebCore {
enum V8ErrorType {
v8RangeError,
v8ReferenceError,
v8SyntaxError,
v8TypeError,
v8GeneralError
};
class V8ThrowException {
public:
static v8::Handle<v8::Value> createDOMException(int ec, const String& message, const v8::Handle<v8::Object>& creationContext, v8::Isolate* isolate)
{
return createDOMException(ec, message, String(), creationContext, isolate);
}
static v8::Handle<v8::Value> createDOMException(int, const String& sanitizedMessage, const String& unsanitizedMessage, const v8::Handle<v8::Object>& creationContext, v8::Isolate*);
static v8::Handle<v8::Value> throwDOMException(int ec, const String& message, const v8::Handle<v8::Object>& creationContext, v8::Isolate* isolate)
{
return throwDOMException(ec, message, String(), creationContext, isolate);
}
static v8::Handle<v8::Value> throwDOMException(int, const String& sanitizedMessage, const String& unsanitizedMessage, const v8::Handle<v8::Object>& creationContext, v8::Isolate*);
static v8::Handle<v8::Value> createError(V8ErrorType, const String&, v8::Isolate*);
static v8::Handle<v8::Value> throwError(V8ErrorType, const String&, v8::Isolate*);
static v8::Handle<v8::Value> throwError(v8::Handle<v8::Value>, v8::Isolate*);
static v8::Handle<v8::Value> createTypeError(const String&, v8::Isolate*);
static v8::Handle<v8::Value> throwTypeError(const String&, v8::Isolate*);
};
}
#endif