diff options
author | Timothy Flynn <trflynn89@pm.me> | 2021-09-11 15:01:40 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-12 00:16:39 +0200 |
commit | 470262c8ab58ba1aea9fecc5098df31d50d44f87 (patch) | |
tree | c2cc6308aa4f4be0cc055280f20fc56a8fc126d2 /Userland | |
parent | 9def17d4cb66bc6e091e430cf711500ee430eba7 (diff) | |
download | serenity-470262c8ab58ba1aea9fecc5098df31d50d44f87.zip |
LibJS: Use ErrorType::NotAnObjectOfType instead of NotA
Diffstat (limited to 'Userland')
39 files changed, 65 insertions, 65 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp index 955c44911a..89aafda333 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp @@ -40,7 +40,7 @@ static ArrayBuffer* array_buffer_object_from(VM& vm, GlobalObject& global_object // ArrayBuffer.prototype.* deliberately don't coerce |this| value to object. auto this_value = vm.this_value(global_object); if (!this_value.is_object() || !is<ArrayBuffer>(this_value.as_object())) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotAn, "ArrayBuffer"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "ArrayBuffer"); return nullptr; } return static_cast<ArrayBuffer*>(&this_value.as_object()); diff --git a/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp index 697f9a8517..81ffa85a67 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp @@ -41,7 +41,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayIteratorPrototype::next) { auto this_value = vm.this_value(global_object); if (!this_value.is_object() || !is<ArrayIterator>(this_value.as_object())) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotAn, "Array Iterator"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Array Iterator"); return {}; } auto& this_object = this_value.as_object(); diff --git a/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp b/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp index 5928ba93f1..0e646f9fae 100644 --- a/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp @@ -43,7 +43,7 @@ static Value this_bigint_value(GlobalObject& global_object, Value value) if (value.is_object() && is<BigIntObject>(value.as_object())) return &static_cast<BigIntObject&>(value.as_object()).bigint(); auto& vm = global_object.vm(); - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "BigInt"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "BigInt"); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp b/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp index 14fcb207ff..609557caf8 100644 --- a/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp @@ -37,7 +37,7 @@ JS_DEFINE_NATIVE_FUNCTION(BooleanPrototype::to_string) if (this_value.is_boolean()) return js_string(vm, this_value.as_bool() ? "true" : "false"); if (!this_value.is_object() || !is<BooleanObject>(this_value.as_object())) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Boolean"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Boolean"); return {}; } @@ -52,7 +52,7 @@ JS_DEFINE_NATIVE_FUNCTION(BooleanPrototype::value_of) if (this_value.is_boolean()) return this_value; if (!this_value.is_object() || !is<BooleanObject>(this_value.as_object())) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Boolean"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Boolean"); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp b/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp index 4a8e7bb923..747200f0fc 100644 --- a/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp @@ -58,7 +58,7 @@ static DataView* typed_this(VM& vm, GlobalObject& global_object) { auto this_value = vm.this_value(global_object); if (!this_value.is_object() || !is<DataView>(this_value.as_object())) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, vm.names.DataView); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, vm.names.DataView); return nullptr; } return static_cast<DataView*>(&this_value.as_object()); diff --git a/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp b/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp index 3c3e85eb3e..ef45c1a314 100644 --- a/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp @@ -27,7 +27,7 @@ static Date* typed_this(VM& vm, GlobalObject& global_object) if (!this_object) return nullptr; if (!is<Date>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Date"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Date"); return nullptr; } return static_cast<Date*>(this_object); diff --git a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp index e9a81b2a92..a0047c8b0c 100644 --- a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp @@ -38,7 +38,7 @@ FinalizationRegistry* FinalizationRegistryPrototype::typed_this(VM& vm, GlobalOb if (!this_object) return nullptr; if (!is<FinalizationRegistry>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "FinalizationRegistry"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "FinalizationRegistry"); return nullptr; } return static_cast<FinalizationRegistry*>(this_object); diff --git a/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp b/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp index f7e5f36155..6472ec7674 100644 --- a/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp @@ -49,7 +49,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::apply) if (!this_object) return {}; if (!this_object->is_function()) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Function"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Function"); return {}; } auto& function = static_cast<FunctionObject&>(*this_object); @@ -70,7 +70,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::bind) if (!this_object) return {}; if (!this_object->is_function()) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Function"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Function"); return {}; } auto& this_function = static_cast<FunctionObject&>(*this_object); @@ -92,7 +92,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::call) if (!this_object) return {}; if (!this_object->is_function()) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Function"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Function"); return {}; } auto& function = static_cast<FunctionObject&>(*this_object); @@ -112,7 +112,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::to_string) if (!this_object) return {}; if (!this_object->is_function()) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Function"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Function"); return {}; } String function_name; diff --git a/Userland/Libraries/LibJS/Runtime/GeneratorObjectPrototype.cpp b/Userland/Libraries/LibJS/Runtime/GeneratorObjectPrototype.cpp index 7fa2f90b9e..6104f62304 100644 --- a/Userland/Libraries/LibJS/Runtime/GeneratorObjectPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/GeneratorObjectPrototype.cpp @@ -16,7 +16,7 @@ static GeneratorObject* typed_this(VM& vm, GlobalObject& global_object) if (!this_object) return {}; if (!is<GeneratorObject>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Generator"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Generator"); return nullptr; } return static_cast<GeneratorObject*>(this_object); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp index 25db52094f..0d4a58d618 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp @@ -22,7 +22,7 @@ static DisplayNames* typed_this(GlobalObject& global_object) return nullptr; if (!is<DisplayNames>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Intl.DisplayNames"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Intl.DisplayNames"); return nullptr; } diff --git a/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.cpp index 908ca11439..fad3eedd89 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.cpp @@ -28,7 +28,7 @@ static ListFormat* typed_this(GlobalObject& global_object) return nullptr; if (!is<ListFormat>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Intl.ListFormat"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Intl.ListFormat"); return nullptr; } diff --git a/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp index a2ffb0afb6..5602d7d454 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp @@ -21,7 +21,7 @@ static Locale* typed_this(GlobalObject& global_object) return nullptr; if (!is<Locale>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Intl.Locale"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Intl.Locale"); return nullptr; } diff --git a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp index 6d11996b1f..cb3477d1b3 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp @@ -20,7 +20,7 @@ static NumberFormat* typed_this(GlobalObject& global_object) return nullptr; if (!is<NumberFormat>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Intl.NumberFormat"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Intl.NumberFormat"); return nullptr; } diff --git a/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp index 1886181109..455429a414 100644 --- a/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp @@ -37,7 +37,7 @@ JS_DEFINE_NATIVE_FUNCTION(MapIteratorPrototype::next) { auto this_value = vm.this_value(global_object); if (!this_value.is_object() || !is<MapIterator>(this_value.as_object())) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Map Iterator"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Map Iterator"); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp b/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp index 6dc1ab01f8..3df310c50a 100644 --- a/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp @@ -48,7 +48,7 @@ Map* MapPrototype::typed_this(VM& vm, GlobalObject& global_object) if (!this_object) return {}; if (!is<Map>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Map"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Map"); return nullptr; } return static_cast<Map*>(this_object); diff --git a/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp b/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp index f17e505a3a..031dd768c0 100644 --- a/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp @@ -52,7 +52,7 @@ static Value this_number_value(GlobalObject& global_object, Value value) if (value.is_object() && is<NumberObject>(value.as_object())) return static_cast<NumberObject&>(value.as_object()).value_of(); auto& vm = global_object.vm(); - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Number"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Number"); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp b/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp index 86d77af681..c343302266 100644 --- a/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp @@ -41,7 +41,7 @@ static Promise* promise_from(VM& vm, GlobalObject& global_object) if (!this_object) return nullptr; if (!is<Promise>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, vm.names.Promise); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, vm.names.Promise); return nullptr; } return static_cast<Promise*>(this_object); diff --git a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp index b74abd5052..3e3f244d71 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp @@ -72,7 +72,7 @@ static RegExpObject* regexp_object_from(VM& vm, GlobalObject& global_object) if (!this_object) return nullptr; if (!is<RegExpObject>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "RegExp"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "RegExp"); return nullptr; } return static_cast<RegExpObject*>(this_object); @@ -325,7 +325,7 @@ Value regexp_exec(GlobalObject& global_object, Object& regexp_object, Utf16Strin } if (!is<RegExpObject>(regexp_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "RegExp"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "RegExp"); return {}; } @@ -339,22 +339,22 @@ Value regexp_exec(GlobalObject& global_object, Object& regexp_object, Utf16Strin // 22.2.5.9 get RegExp.prototype.multiline, https://tc39.es/ecma262/#sec-get-regexp.prototype.multiline // 22.2.5.14 get RegExp.prototype.sticky, https://tc39.es/ecma262/#sec-get-regexp.prototype.sticky // 22.2.5.17 get RegExp.prototype.unicode, https://tc39.es/ecma262/#sec-get-regexp.prototype.unicode -#define __JS_ENUMERATE(flagName, flag_name, flag_char) \ - JS_DEFINE_NATIVE_GETTER(RegExpPrototype::flag_name) \ - { \ - auto* regexp_object = this_object_from(vm, global_object); \ - if (!regexp_object) \ - return {}; \ - \ - if (!is<RegExpObject>(regexp_object)) { \ - if (same_value(regexp_object, global_object.regexp_prototype())) \ - return js_undefined(); \ - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "RegExp"); \ - return {}; \ - } \ - \ - auto const& flags = static_cast<RegExpObject*>(regexp_object)->flags(); \ - return Value(flags.contains(#flag_char##sv)); \ +#define __JS_ENUMERATE(flagName, flag_name, flag_char) \ + JS_DEFINE_NATIVE_GETTER(RegExpPrototype::flag_name) \ + { \ + auto* regexp_object = this_object_from(vm, global_object); \ + if (!regexp_object) \ + return {}; \ + \ + if (!is<RegExpObject>(regexp_object)) { \ + if (same_value(regexp_object, global_object.regexp_prototype())) \ + return js_undefined(); \ + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "RegExp"); \ + return {}; \ + } \ + \ + auto const& flags = static_cast<RegExpObject*>(regexp_object)->flags(); \ + return Value(flags.contains(#flag_char##sv)); \ } JS_ENUMERATE_REGEXP_FLAGS #undef __JS_ENUMERATE @@ -390,7 +390,7 @@ JS_DEFINE_NATIVE_GETTER(RegExpPrototype::source) if (!is<RegExpObject>(regexp_object)) { if (same_value(regexp_object, global_object.regexp_prototype())) return js_string(vm, "(?:)"); - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "RegExp"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "RegExp"); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/RegExpStringIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/RegExpStringIteratorPrototype.cpp index 0d56903acd..f3a6ae2bb7 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpStringIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/RegExpStringIteratorPrototype.cpp @@ -36,7 +36,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpStringIteratorPrototype::next) // For details, see the 'closure' of: https://tc39.es/ecma262/#sec-createregexpstringiterator auto this_value = vm.this_value(global_object); if (!this_value.is_object() || !is<RegExpStringIterator>(this_value.as_object())) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "RegExp String Iterator"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "RegExp String Iterator"); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.cpp index a9ed348759..0d8c26b430 100644 --- a/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.cpp @@ -39,7 +39,7 @@ JS_DEFINE_NATIVE_FUNCTION(SetIteratorPrototype::next) { auto this_value = vm.this_value(global_object); if (!this_value.is_object() || !is<SetIterator>(this_value.as_object())) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Set Iterator"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Set Iterator"); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp b/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp index 6b0ef4031b..89ef9596f1 100644 --- a/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp @@ -50,7 +50,7 @@ Set* SetPrototype::typed_this(VM& vm, GlobalObject& global_object) if (!this_object) return {}; if (!is<Set>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Set"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Set"); return nullptr; } return static_cast<Set*>(this_object); diff --git a/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp index 665b35bcb9..add4249869 100644 --- a/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp @@ -38,7 +38,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringIteratorPrototype::next) { auto this_value = vm.this_value(global_object); if (!this_value.is_object() || !is<StringIterator>(this_value.as_object())) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "String Iterator"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "String Iterator"); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp index a415ffce4c..963a3d3379 100644 --- a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp @@ -175,7 +175,7 @@ static Value this_string_value(GlobalObject& global_object, Value value) if (value.is_object() && is<StringObject>(value.as_object())) return static_cast<StringObject&>(value.as_object()).value_of(); auto& vm = global_object.vm(); - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "String"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "String"); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp b/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp index da1c436cb2..bd97834680 100644 --- a/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp @@ -48,7 +48,7 @@ static Value this_symbol_value(GlobalObject& global_object, Value value) if (value.is_object() && is<SymbolObject>(value.as_object())) return static_cast<SymbolObject&>(value.as_object()).value_of(); auto& vm = global_object.vm(); - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Symbol"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Symbol"); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp index 1e51803d11..9a7909902e 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp @@ -456,7 +456,7 @@ PlainDate* date_from_fields(GlobalObject& global_object, Object& calendar, Objec if (!date_object) return {}; if (!is<PlainDate>(date_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.PlainDate"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.PlainDate"); return {}; } @@ -486,7 +486,7 @@ PlainYearMonth* year_month_from_fields(GlobalObject& global_object, Object& cale if (!year_month_object) return {}; if (!is<PlainYearMonth>(year_month_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.PlainYearMonth"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.PlainYearMonth"); return {}; } @@ -516,7 +516,7 @@ PlainMonthDay* month_day_from_fields(GlobalObject& global_object, Object& calend if (!month_day_object) return {}; if (!is<PlainMonthDay>(month_day_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.PlainMonthDay"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.PlainMonthDay"); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp index cc3d08f52c..dfbab41ee9 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp @@ -68,7 +68,7 @@ static Calendar* typed_this(GlobalObject& global_object) if (!this_object) return {}; if (!is<Calendar>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.Calendar"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.Calendar"); return {}; } return static_cast<Calendar*>(this_object); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp index c912d6abdc..128d24120d 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp @@ -54,7 +54,7 @@ static Duration* typed_this(GlobalObject& global_object) if (!this_object) return {}; if (!is<Duration>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.Duration"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.Duration"); return {}; } return static_cast<Duration*>(this_object); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp index bb9f84995f..8d8be8a44f 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp @@ -59,7 +59,7 @@ static Instant* typed_this(GlobalObject& global_object) if (!this_object) return {}; if (!is<Instant>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.Instant"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.Instant"); return {}; } return static_cast<Instant*>(this_object); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp index 258cd26112..1a38f52cc8 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp @@ -69,7 +69,7 @@ static PlainDate* typed_this(GlobalObject& global_object) if (!this_object) return {}; if (!is<PlainDate>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.PlainDate"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.PlainDate"); return {}; } return static_cast<PlainDate*>(this_object); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp index adcd531823..50676680ac 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp @@ -72,7 +72,7 @@ static PlainDateTime* typed_this(GlobalObject& global_object) if (!this_object) return {}; if (!is<PlainDateTime>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.PlainDateTime"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.PlainDateTime"); return {}; } return static_cast<PlainDateTime*>(this_object); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp index 67900d8d9a..16a584c0f1 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp @@ -48,7 +48,7 @@ static PlainMonthDay* typed_this(GlobalObject& global_object) if (!this_object) return {}; if (!is<PlainMonthDay>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.PlainMonthDay"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.PlainMonthDay"); return {}; } return static_cast<PlainMonthDay*>(this_object); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp index 7795d970bc..78c9b6d535 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp @@ -55,7 +55,7 @@ static PlainTime* typed_this(GlobalObject& global_object) if (!this_object) return {}; if (!is<PlainTime>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.PlainTime"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.PlainTime"); return {}; } return static_cast<PlainTime*>(this_object); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp index 36b5efb9ae..10b8c3913d 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp @@ -55,7 +55,7 @@ static PlainYearMonth* typed_this(GlobalObject& global_object) if (!this_object) return {}; if (!is<PlainYearMonth>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.PlainYearMonth"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.PlainYearMonth"); return {}; } return static_cast<PlainYearMonth*>(this_object); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp index 51b5b1c9b9..f86a627788 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp @@ -45,7 +45,7 @@ static TimeZone* typed_this(GlobalObject& global_object) if (!this_object) return {}; if (!is<TimeZone>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.TimeZone"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.TimeZone"); return {}; } return static_cast<TimeZone*>(this_object); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp index 4e3e55650d..48d19c190b 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp @@ -80,7 +80,7 @@ static ZonedDateTime* typed_this(GlobalObject& global_object) if (!this_object) return {}; if (!is<ZonedDateTime>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Temporal.ZonedDateTime"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.ZonedDateTime"); return {}; } return static_cast<ZonedDateTime*>(this_object); diff --git a/Userland/Libraries/LibJS/Runtime/TypedArray.cpp b/Userland/Libraries/LibJS/Runtime/TypedArray.cpp index ac1781e6c5..4d3bc4ffb4 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArray.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArray.cpp @@ -23,7 +23,7 @@ TypedArrayBase* typed_array_from(GlobalObject& global_object, Value typed_array_ if (!this_object) return nullptr; if (!this_object->is_typed_array()) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "TypedArray"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "TypedArray"); return nullptr; } @@ -36,7 +36,7 @@ void validate_typed_array(GlobalObject& global_object, TypedArrayBase& typed_arr auto& vm = global_object.vm(); if (!typed_array.is_typed_array()) - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "TypedArray"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "TypedArray"); else if (typed_array.viewed_array_buffer()->is_detached()) vm.throw_exception<TypeError>(global_object, ErrorType::DetachedArrayBuffer); } @@ -246,7 +246,7 @@ TypedArrayBase* typed_array_create(GlobalObject& global_object, FunctionObject& if (vm.exception()) return nullptr; if (!new_typed_array.is_object() || !new_typed_array.as_object().is_typed_array()) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "TypedArray"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "TypedArray"); return nullptr; } auto& typed_array = static_cast<TypedArrayBase&>(new_typed_array.as_object()); diff --git a/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp b/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp index a64825511a..027c1603d4 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp @@ -40,7 +40,7 @@ WeakMap* WeakMapPrototype::typed_this(VM& vm, GlobalObject& global_object) if (!this_object) return {}; if (!is<WeakMap>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "WeakMap"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "WeakMap"); return nullptr; } return static_cast<WeakMap*>(this_object); diff --git a/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp b/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp index 8f9a3858f8..120855fdcf 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp @@ -35,7 +35,7 @@ JS_DEFINE_NATIVE_FUNCTION(WeakRefPrototype::deref) if (!this_object) return {}; if (!is<WeakRef>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "WeakRef"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "WeakRef"); return {}; } auto& weak_ref = static_cast<WeakRef&>(*this_object); diff --git a/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp b/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp index bc4ed91d1b..2592686746 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp @@ -39,7 +39,7 @@ WeakSet* WeakSetPrototype::typed_this(VM& vm, GlobalObject& global_object) if (!this_object) return {}; if (!is<WeakSet>(this_object)) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "WeakSet"); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOfType, "WeakSet"); return nullptr; } return static_cast<WeakSet*>(this_object); |