mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-24 18:28:57 +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:
parent
153b793638
commit
88814acbd3
Notes:
sideshowbarker
2024-07-17 02:38:39 +09:00
Author: https://github.com/trflynn89
Commit: 88814acbd3
Pull-request: https://github.com/SerenityOS/serenity/pull/17494
Reviewed-by: https://github.com/linusg ✅
36 changed files with 198 additions and 151 deletions
|
@ -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());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue