1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +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

@ -82,7 +82,7 @@ ErrorOr<void> MarkupGenerator::value_to_html(Value value, StringBuilder& output_
if (value.is_string())
TRY(output_html.try_append('"'));
TRY(output_html.try_append(escape_html_entities(TRY(value.to_string_without_side_effects()))));
TRY(output_html.try_append(escape_html_entities(value.to_string_without_side_effects())));
if (value.is_string())
TRY(output_html.try_append('"'));
@ -168,8 +168,8 @@ ErrorOr<void> MarkupGenerator::error_to_html(Error const& error, StringBuilder&
auto& vm = error.vm();
auto name = error.get_without_side_effects(vm.names.name).value_or(js_undefined());
auto message = error.get_without_side_effects(vm.names.message).value_or(js_undefined());
auto name_string = TRY(name.to_string_without_side_effects());
auto message_string = TRY(message.to_string_without_side_effects());
auto name_string = name.to_string_without_side_effects();
auto message_string = message.to_string_without_side_effects();
auto uncaught_message = TRY(String::formatted("Uncaught {}[{}]: ", in_promise ? "(in promise) " : "", name_string));
TRY(html_output.try_append(TRY(wrap_string_in_style(uncaught_message, StyleType::Invalid)).bytes_as_string_view()));