1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:57:45 +00:00

LibJS+Everywhere: Convert JS::Error to String

This includes an Error::create overload to create an Error from a UTF-8
StringView. If creating a String from that view fails, the factory will
return an OOM InternalError instead. VM::throw_completion can also make
use of this overload via its perfect forwarding.
This commit is contained in:
Timothy Flynn 2023-02-16 14:09:11 -05:00 committed by Tim Flynn
parent 153b793638
commit 88814acbd3
36 changed files with 198 additions and 151 deletions

View file

@ -172,7 +172,7 @@ JS::ThrowCompletionOr<JS::Value> Sheet::evaluate(StringView source, Cell* on_beh
name);
if (script_or_error.is_error())
return interpreter().vm().throw_completion<JS::SyntaxError>(script_or_error.error().first().to_deprecated_string());
return interpreter().vm().throw_completion<JS::SyntaxError>(TRY_OR_THROW_OOM(interpreter().vm(), script_or_error.error().first().to_string()));
return interpreter().run(script_or_error.value());
}