1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:18:13 +00:00

LibJS: Convert install_error_cause() to ThrowCompletionOr

This commit is contained in:
Linus Groh 2021-10-02 16:03:45 +01:00
parent 4d5bd092ea
commit 867b19affb
4 changed files with 25 additions and 19 deletions

View file

@ -48,9 +48,7 @@ Value ErrorConstructor::construct(FunctionObject& new_target)
error->create_non_enumerable_data_property_or_throw(vm.names.message, js_string(vm, message));
}
error->install_error_cause(vm.argument(1));
if (vm.exception())
return {};
TRY_OR_DISCARD(error->install_error_cause(vm.argument(1)));
return error;
}
@ -97,9 +95,7 @@ Value ErrorConstructor::construct(FunctionObject& new_target)
error->create_non_enumerable_data_property_or_throw(vm.names.message, js_string(vm, message)); \
} \
\
error->install_error_cause(vm.argument(1)); \
if (vm.exception()) \
return {}; \
TRY_OR_DISCARD(error->install_error_cause(vm.argument(1))); \
\
return error; \
}