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 22 namespace panda::ecmascript::builtins { 23 class BuiltinsError : public base::BuiltinsBase { 24 public: 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 32 class BuiltinsRangeError : public base::BuiltinsBase { 33 public: 34 static JSTaggedValue RangeErrorConstructor(EcmaRuntimeCallInfo *argv); 35 36 static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv); 37 }; 38 39 // 19.5.5.3 40 class BuiltinsReferenceError : public base::BuiltinsBase { 41 public: 42 static JSTaggedValue ReferenceErrorConstructor(EcmaRuntimeCallInfo *argv); 43 44 static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv); 45 }; 46 47 // 19.5.5.5 48 class BuiltinsTypeError : public base::BuiltinsBase { 49 public: 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 58 class BuiltinsURIError : public base::BuiltinsBase { 59 public: 60 static JSTaggedValue URIErrorConstructor(EcmaRuntimeCallInfo *argv); 61 62 static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv); 63 }; 64 65 // 19.5.5.4 66 class BuiltinsSyntaxError : public base::BuiltinsBase { 67 public: 68 static JSTaggedValue SyntaxErrorConstructor(EcmaRuntimeCallInfo *argv); 69 70 static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv); 71 }; 72 73 // 19.5.5.1 74 class BuiltinsEvalError : public base::BuiltinsBase { 75 public: 76 static JSTaggedValue EvalErrorConstructor(EcmaRuntimeCallInfo *argv); 77 78 static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv); 79 }; 80 81 82 class BuiltinsAggregateError : public base::BuiltinsBase { 83 public: 84 static JSTaggedValue AggregateErrorConstructor(EcmaRuntimeCallInfo *argv); 85 86 static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv); 87 }; 88 89 class BuiltinsOOMError : public base::BuiltinsBase { 90 public: 91 static JSTaggedValue OOMErrorConstructor(EcmaRuntimeCallInfo *argv); 92 93 static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv); 94 }; 95 } // namespace panda::ecmascript::builtins 96 #endif // ECMASCRIPT_BUILTINS_BUILTINS_ERRORS_H 97