1/* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16#ifndef ECMASCRIPT_BUILTINS_BUILTINS_ERRORS_H 17#define ECMASCRIPT_BUILTINS_BUILTINS_ERRORS_H 18 19#include "ecmascript/base/builtins_base.h" 20#include "ecmascript/ecma_runtime_call_info.h" 21 22namespace panda::ecmascript::builtins { 23class BuiltinsError : public base::BuiltinsBase { 24public: 25 // 19.5.1.1 26 static JSTaggedValue ErrorConstructor(EcmaRuntimeCallInfo *argv); 27 // 19.5.2.4 28 static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv); 29}; 30 31// 19.5.5.2 32class BuiltinsRangeError : public base::BuiltinsBase { 33public: 34 static JSTaggedValue RangeErrorConstructor(EcmaRuntimeCallInfo *argv); 35 36 static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv); 37}; 38 39// 19.5.5.3 40class BuiltinsReferenceError : public base::BuiltinsBase { 41public: 42 static JSTaggedValue ReferenceErrorConstructor(EcmaRuntimeCallInfo *argv); 43 44 static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv); 45}; 46 47// 19.5.5.5 48class BuiltinsTypeError : public base::BuiltinsBase { 49public: 50 static JSTaggedValue TypeErrorConstructor(EcmaRuntimeCallInfo *argv); 51 52 static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv); 53 54 static JSTaggedValue ThrowTypeError(EcmaRuntimeCallInfo *argv); 55}; 56 57// 19.5.5.6 58class BuiltinsURIError : public base::BuiltinsBase { 59public: 60 static JSTaggedValue URIErrorConstructor(EcmaRuntimeCallInfo *argv); 61 62 static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv); 63}; 64 65// 19.5.5.4 66class BuiltinsSyntaxError : public base::BuiltinsBase { 67public: 68 static JSTaggedValue SyntaxErrorConstructor(EcmaRuntimeCallInfo *argv); 69 70 static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv); 71}; 72 73// 19.5.5.1 74class BuiltinsEvalError : public base::BuiltinsBase { 75public: 76 static JSTaggedValue EvalErrorConstructor(EcmaRuntimeCallInfo *argv); 77 78 static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv); 79}; 80 81 82class BuiltinsAggregateError : public base::BuiltinsBase { 83public: 84 static JSTaggedValue AggregateErrorConstructor(EcmaRuntimeCallInfo *argv); 85 86 static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv); 87}; 88 89class BuiltinsOOMError : public base::BuiltinsBase { 90public: 91 static JSTaggedValue OOMErrorConstructor(EcmaRuntimeCallInfo *argv); 92 93 static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv); 94}; 95 96class BuiltinsTerminationError : public base::BuiltinsBase { 97public: 98 static JSTaggedValue TerminationErrorConstructor(EcmaRuntimeCallInfo *argv); 99 100 static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv); 101}; 102} // namespace panda::ecmascript::builtins 103#endif // ECMASCRIPT_BUILTINS_BUILTINS_ERRORS_H 104