mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:07:35 +00:00
LibJS: Convert has_property() to ThrowCompletionOr
This commit is contained in:
parent
a29b7a3ec7
commit
f38a5957bf
11 changed files with 53 additions and 135 deletions
|
@ -36,12 +36,7 @@ ThrowCompletionOr<void> Error::install_error_cause(Value options)
|
|||
auto& vm = this->vm();
|
||||
|
||||
// 1. If Type(options) is Object and ? HasProperty(options, "cause") is true, then
|
||||
if (!options.is_object())
|
||||
return {};
|
||||
auto has_property = options.as_object().has_property(vm.names.cause);
|
||||
if (auto* exception = vm.exception())
|
||||
return throw_completion(exception->value());
|
||||
if (has_property) {
|
||||
if (options.is_object() && TRY(options.as_object().has_property(vm.names.cause))) {
|
||||
// a. Let cause be ? Get(options, "cause").
|
||||
auto cause = TRY(options.as_object().get(vm.names.cause));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue