diff options
author | Matthew Olsson <matthewcolsson@gmail.com> | 2020-06-09 22:48:01 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-06-11 07:46:20 +0200 |
commit | 78155a66686b03a18eec1ea189ec43b06c51b51a (patch) | |
tree | df71a780992a3827f8de5f3950d92c186f2db7e9 /Libraries/LibJS/Runtime/Array.cpp | |
parent | 9940a7f6def5c3c03412fd0540f238d5413bb90a (diff) | |
download | serenity-78155a66686b03a18eec1ea189ec43b06c51b51a.zip |
LibJS: Consolidate error messages into ErrorTypes.h
Now, exceptions can be thrown with
interpreter.throw_exception<T>(ErrorType:TYPE, "format", "args",
"here").
Diffstat (limited to 'Libraries/LibJS/Runtime/Array.cpp')
-rw-r--r-- | Libraries/LibJS/Runtime/Array.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Libraries/LibJS/Runtime/Array.cpp b/Libraries/LibJS/Runtime/Array.cpp index 70ee69c077..fdd2e0ac03 100644 --- a/Libraries/LibJS/Runtime/Array.cpp +++ b/Libraries/LibJS/Runtime/Array.cpp @@ -55,7 +55,7 @@ Array* array_from(Interpreter& interpreter, GlobalObject& global_object) if (!this_object) return {}; if (!this_object->is_array()) { - interpreter.throw_exception<TypeError>("Not an Array"); + interpreter.throw_exception<TypeError>(ErrorType::NotAn, "Array"); return nullptr; } return static_cast<Array*>(this_object); @@ -78,7 +78,7 @@ void Array::length_setter(Interpreter& interpreter, Value value) if (interpreter.exception()) return; if (length.is_nan() || length.is_infinity() || length.as_double() < 0) { - interpreter.throw_exception<RangeError>("Invalid array length"); + interpreter.throw_exception<RangeError>(ErrorType::ArrayInvalidLength); return; } array->indexed_properties().set_array_like_size(length.as_double()); |