1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:07:34 +00:00

LibJS: Convert internal_get_own_property() to ThrowCompletionOr

This commit is contained in:
Linus Groh 2021-09-29 17:53:57 +01:00
parent 73bae7d779
commit 0e69a6e487
19 changed files with 100 additions and 166 deletions

View file

@ -103,7 +103,10 @@ void ObjectEnvironment::set_mutable_binding(GlobalObject& global_object, FlyStri
// Note: Nothing like this in the spec, this is here to produce nicer errors instead of the generic one thrown by Object::set().
if (!result && strict) {
auto property = m_binding_object.internal_get_own_property(name);
auto property_or_error = m_binding_object.internal_get_own_property(name);
if (property_or_error.is_error())
return;
auto property = property_or_error.release_value();
if (property.has_value() && !property->writable.value_or(true)) {
vm.clear_exception();
vm.throw_exception<TypeError>(global_object, ErrorType::DescWriteNonWritable, name);