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.
This commit is contained in:
Linus Groh 2021-09-05 20:13:06 +01:00
parent 782e7834c3
commit 9998a2c91e
Notes: sideshowbarker 2024-07-18 04:39:59 +09:00
3 changed files with 3 additions and 2 deletions

View file

@ -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 {};
}

View file

@ -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 {}") \

View file

@ -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);
}