diff options
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp index 5890d49697..efd4cafbe2 100644 --- a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp @@ -221,9 +221,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::freeze) auto argument = vm.argument(0); if (!argument.is_object()) return argument; - auto status = argument.as_object().set_integrity_level(Object::IntegrityLevel::Frozen); - if (vm.exception()) - return {}; + auto status = TRY_OR_DISCARD(argument.as_object().set_integrity_level(Object::IntegrityLevel::Frozen)); if (!status) { vm.throw_exception<TypeError>(global_object, ErrorType::ObjectFreezeFailed); return {}; @@ -272,9 +270,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::seal) auto argument = vm.argument(0); if (!argument.is_object()) return argument; - auto status = argument.as_object().set_integrity_level(Object::IntegrityLevel::Sealed); - if (vm.exception()) - return {}; + auto status = TRY_OR_DISCARD(argument.as_object().set_integrity_level(Object::IntegrityLevel::Sealed)); if (!status) { vm.throw_exception<TypeError>(global_object, ErrorType::ObjectSealFailed); return {}; |