1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

LibJS: Make Value::to_string_without_side_effects() infallible

Work towards #20449.
This commit is contained in:
Andreas Kling 2023-08-09 08:49:02 +02:00
parent b8f78c0adc
commit 97ebfd9f0f
69 changed files with 182 additions and 182 deletions

View file

@ -206,7 +206,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::define_property)
{
// 1. If O is not an Object, throw a TypeError exception.
if (!vm.argument(0).is_object())
return vm.throw_completion<TypeError>(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, vm.argument(0).to_string_without_side_effects()));
return vm.throw_completion<TypeError>(ErrorType::NotAnObject, vm.argument(0).to_string_without_side_effects());
auto object = MUST(vm.argument(0).to_object(vm));
@ -276,7 +276,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::from_entries)
// 6. Return ? AddEntriesFromIterable(obj, iterable, adder).
(void)TRY(get_iterator_values(vm, iterable, [&](Value iterator_value) -> Optional<Completion> {
if (!iterator_value.is_object())
return vm.throw_completion<TypeError>(ErrorType::NotAnObject, DeprecatedString::formatted("Iterator value {}", TRY_OR_THROW_OOM(vm, iterator_value.to_string_without_side_effects())));
return vm.throw_completion<TypeError>(ErrorType::NotAnObject, DeprecatedString::formatted("Iterator value {}", iterator_value.to_string_without_side_effects()));
auto key = TRY(iterator_value.as_object().get(0));
auto value = TRY(iterator_value.as_object().get(1));