mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:27:35 +00:00
LibJS: Convert ordinary_create_from_constructor<T> to ThrowCompletionOr
This commit is contained in:
parent
b61eff8730
commit
5a4c90fcb1
30 changed files with 38 additions and 93 deletions
|
@ -39,9 +39,7 @@ Value ErrorConstructor::construct(FunctionObject& new_target)
|
|||
auto& vm = this->vm();
|
||||
auto& global_object = this->global_object();
|
||||
|
||||
auto* error = ordinary_create_from_constructor<Error>(global_object, new_target, &GlobalObject::error_prototype);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
auto* error = TRY_OR_DISCARD(ordinary_create_from_constructor<Error>(global_object, new_target, &GlobalObject::error_prototype));
|
||||
|
||||
if (!vm.argument(0).is_undefined()) {
|
||||
auto message = vm.argument(0).to_string(global_object);
|
||||
|
@ -89,10 +87,8 @@ Value ErrorConstructor::construct(FunctionObject& new_target)
|
|||
auto& vm = this->vm(); \
|
||||
auto& global_object = this->global_object(); \
|
||||
\
|
||||
auto* error = ordinary_create_from_constructor<ClassName>( \
|
||||
global_object, new_target, &GlobalObject::snake_name##_prototype); \
|
||||
if (vm.exception()) \
|
||||
return {}; \
|
||||
auto* error = TRY_OR_DISCARD(ordinary_create_from_constructor<ClassName>( \
|
||||
global_object, new_target, &GlobalObject::snake_name##_prototype)); \
|
||||
\
|
||||
if (!vm.argument(0).is_undefined()) { \
|
||||
auto message = vm.argument(0).to_string(global_object); \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue