2 * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
3 * Copyright (C) 2001 Peter Kelly (pmk@post.com)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
39 // Methods to create a range of internal errors.
40 JSObject* createError(JSGlobalObject*, const UString&);
41 JSObject* createEvalError(JSGlobalObject*, const UString&);
42 JSObject* createRangeError(JSGlobalObject*, const UString&);
43 JSObject* createReferenceError(JSGlobalObject*, const UString&);
44 JSObject* createSyntaxError(JSGlobalObject*, const UString&);
45 JSObject* createTypeError(JSGlobalObject*, const UString&);
46 JSObject* createURIError(JSGlobalObject*, const UString&);
47 // ExecState wrappers.
48 JSObject* createError(ExecState*, const UString&);
49 JSObject* createEvalError(ExecState*, const UString&);
50 JSObject* createRangeError(ExecState*, const UString&);
51 JSObject* createReferenceError(ExecState*, const UString&);
52 JSObject* createSyntaxError(ExecState*, const UString&);
53 JSObject* createTypeError(ExecState*, const UString&);
54 JSObject* createURIError(ExecState*, const UString&);
57 bool hasErrorInfo(ExecState*, JSObject* error);
58 JSObject* addErrorInfo(JSGlobalData*, JSObject* error, int line, const SourceCode&);
59 // ExecState wrappers.
60 JSObject* addErrorInfo(ExecState*, JSObject* error, int line, const SourceCode&);
62 // Methods to throw Errors.
63 JSValue throwError(ExecState*, JSValue);
64 JSObject* throwError(ExecState*, JSObject*);
66 // Convenience wrappers, create an throw an exception with a default message.
67 JSObject* throwTypeError(ExecState*);
68 JSObject* throwSyntaxError(ExecState*);
70 // Convenience wrappers, wrap result as an EncodedJSValue.
71 inline EncodedJSValue throwVMError(ExecState* exec, JSValue error) { return JSValue::encode(throwError(exec, error)); }
72 inline EncodedJSValue throwVMTypeError(ExecState* exec) { return JSValue::encode(throwTypeError(exec)); }
74 JSValue createTypeErrorFunction(ExecState* exec, const UString& message);