diff options
author | Linus Groh <mail@linusgroh.de> | 2021-09-05 20:13:06 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-09-05 22:17:09 +0100 |
commit | 9998a2c91e5e6b09bcec12929bc29a170b276c10 (patch) | |
tree | 887e269e94f38d5c674f6805e46efcd9a513e278 /Userland/Libraries/LibJS | |
parent | 782e7834c38f1abf5ab6ac9f741a3119c72f947a (diff) | |
download | serenity-9998a2c91e5e6b09bcec12929bc29a170b276c10.zip |
LibJS: Add ErrorType::CallStackSizeExceeded
I'm about to add another use of this, so let's add an ErrorType for it
instead of hardcoding the message for a third time.
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/ErrorTypes.h | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/VM.h | 2 |
3 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp index 435908b7cf..3eb7c3a5a4 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp @@ -1946,7 +1946,7 @@ static size_t flatten_into_array(GlobalObject& global_object, Object& new_array, if (depth > 0 && value.is_array(global_object)) { if (vm.did_reach_stack_space_limit()) { - vm.throw_exception<Error>(global_object, "Call stack size limit exceeded"); + vm.throw_exception<Error>(global_object, ErrorType::CallStackSizeExceeded); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/ErrorTypes.h b/Userland/Libraries/LibJS/Runtime/ErrorTypes.h index 54041eff20..1ed7e8da73 100644 --- a/Userland/Libraries/LibJS/Runtime/ErrorTypes.h +++ b/Userland/Libraries/LibJS/Runtime/ErrorTypes.h @@ -15,6 +15,7 @@ M(BigIntFromNonIntegral, "Cannot convert non-integral number to BigInt") \ M(BigIntInvalidValue, "Invalid value for BigInt: {}") \ M(BindingNotInitialized, "Binding {} is not initialized") \ + M(CallStackSizeExceeded, "Call stack size limit exceeded") \ M(ClassConstructorWithoutNew, "Class constructor {} must be called with 'new'") \ M(ClassExtendsValueNotAConstructorOrNull, "Class extends value {} is not a constructor or null") \ M(ClassExtendsValueInvalidPrototype, "Class extends value has an invalid prototype {}") \ diff --git a/Userland/Libraries/LibJS/Runtime/VM.h b/Userland/Libraries/LibJS/Runtime/VM.h index 4b25bb3e3b..579f5dbdc3 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.h +++ b/Userland/Libraries/LibJS/Runtime/VM.h @@ -116,7 +116,7 @@ public: VERIFY(!exception()); // Ensure we got some stack space left, so the next function call doesn't kill us. if (did_reach_stack_space_limit()) - throw_exception<Error>(global_object, "Call stack size limit exceeded"); + throw_exception<Error>(global_object, ErrorType::CallStackSizeExceeded); else m_execution_context_stack.append(&context); } |