mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +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
Notes:
sideshowbarker
2024-07-18 04:39:59 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/9998a2c91e5 Pull-request: https://github.com/SerenityOS/serenity/pull/9842 Reviewed-by: https://github.com/IdanHo ✅
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 (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 {};
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {}") \
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue