mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:37:44 +00:00
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:
parent
782e7834c3
commit
9998a2c91e
3 changed files with 3 additions and 2 deletions
|
@ -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 (depth > 0 && value.is_array(global_object)) {
|
||||||
if (vm.did_reach_stack_space_limit()) {
|
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 {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
M(BigIntFromNonIntegral, "Cannot convert non-integral number to BigInt") \
|
M(BigIntFromNonIntegral, "Cannot convert non-integral number to BigInt") \
|
||||||
M(BigIntInvalidValue, "Invalid value for BigInt: {}") \
|
M(BigIntInvalidValue, "Invalid value for BigInt: {}") \
|
||||||
M(BindingNotInitialized, "Binding {} is not initialized") \
|
M(BindingNotInitialized, "Binding {} is not initialized") \
|
||||||
|
M(CallStackSizeExceeded, "Call stack size limit exceeded") \
|
||||||
M(ClassConstructorWithoutNew, "Class constructor {} must be called with 'new'") \
|
M(ClassConstructorWithoutNew, "Class constructor {} must be called with 'new'") \
|
||||||
M(ClassExtendsValueNotAConstructorOrNull, "Class extends value {} is not a constructor or null") \
|
M(ClassExtendsValueNotAConstructorOrNull, "Class extends value {} is not a constructor or null") \
|
||||||
M(ClassExtendsValueInvalidPrototype, "Class extends value has an invalid prototype {}") \
|
M(ClassExtendsValueInvalidPrototype, "Class extends value has an invalid prototype {}") \
|
||||||
|
|
|
@ -116,7 +116,7 @@ public:
|
||||||
VERIFY(!exception());
|
VERIFY(!exception());
|
||||||
// Ensure we got some stack space left, so the next function call doesn't kill us.
|
// Ensure we got some stack space left, so the next function call doesn't kill us.
|
||||||
if (did_reach_stack_space_limit())
|
if (did_reach_stack_space_limit())
|
||||||
throw_exception<Error>(global_object, "Call stack size limit exceeded");
|
throw_exception<Error>(global_object, ErrorType::CallStackSizeExceeded);
|
||||||
else
|
else
|
||||||
m_execution_context_stack.append(&context);
|
m_execution_context_stack.append(&context);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue