summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/JSONObject.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-10-03 00:53:06 +0100
committerLinus Groh <mail@linusgroh.de>2021-10-03 20:14:03 +0100
commitfb443b3fb45d26d5275600a3eda7f4ea4abb82da (patch)
treee6fdbf62795c0e0d5965f2900f119119ca37128d /Userland/Libraries/LibJS/Runtime/JSONObject.cpp
parent1d45541278abc95f3ef996b5629a3a0cc9cf8461 (diff)
downloadserenity-fb443b3fb45d26d5275600a3eda7f4ea4abb82da.zip
LibJS: Convert create_data_property() to ThrowCompletionOr
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/JSONObject.cpp')
-rw-r--r--Userland/Libraries/LibJS/Runtime/JSONObject.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/JSONObject.cpp b/Userland/Libraries/LibJS/Runtime/JSONObject.cpp
index 41e26403b6..7473125bdc 100644
--- a/Userland/Libraries/LibJS/Runtime/JSONObject.cpp
+++ b/Userland/Libraries/LibJS/Runtime/JSONObject.cpp
@@ -468,13 +468,10 @@ Value JSONObject::internalize_json_property(GlobalObject& global_object, Object*
auto element = internalize_json_property(global_object, &value_object, key, reviver);
if (auto* exception = vm.exception())
return throw_completion(exception->value());
- if (element.is_undefined()) {
+ if (element.is_undefined())
TRY(value_object.internal_delete(key));
- } else {
- value_object.create_data_property(key, element);
- if (auto* exception = vm.exception())
- return throw_completion(exception->value());
- }
+ else
+ TRY(value_object.create_data_property(key, element));
return {};
};