mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:17:35 +00:00
LibJS: Convert delete_property_or_throw() to ThrowCompletionOr
This commit is contained in:
parent
fe86b04b42
commit
a29b7a3ec7
4 changed files with 19 additions and 48 deletions
|
@ -219,7 +219,7 @@ ThrowCompletionOr<bool> Object::define_property_or_throw(PropertyName const& pro
|
|||
}
|
||||
|
||||
// 7.3.9 DeletePropertyOrThrow ( O, P ), https://tc39.es/ecma262/#sec-deletepropertyorthrow
|
||||
bool Object::delete_property_or_throw(PropertyName const& property_name)
|
||||
ThrowCompletionOr<bool> Object::delete_property_or_throw(PropertyName const& property_name)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -229,13 +229,12 @@ bool Object::delete_property_or_throw(PropertyName const& property_name)
|
|||
VERIFY(property_name.is_valid());
|
||||
|
||||
// 3. Let success be ? O.[[Delete]](P).
|
||||
auto success = TRY_OR_DISCARD(internal_delete(property_name));
|
||||
auto success = TRY(internal_delete(property_name));
|
||||
|
||||
// 4. If success is false, throw a TypeError exception.
|
||||
if (!success) {
|
||||
// FIXME: Improve/contextualize error message
|
||||
vm.throw_exception<TypeError>(global_object(), ErrorType::ObjectDeleteReturnedFalse);
|
||||
return {};
|
||||
return vm.throw_completion<TypeError>(global_object(), ErrorType::ObjectDeleteReturnedFalse);
|
||||
}
|
||||
|
||||
// 5. Return success.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue