mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:47:44 +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
36 changed files with 198 additions and 151 deletions
|
@ -98,7 +98,7 @@ JS_DEFINE_NATIVE_FUNCTION($262Object::eval_script)
|
|||
auto& error = script_or_error.error()[0];
|
||||
|
||||
// b. Return Completion { [[Type]]: throw, [[Value]]: error, [[Target]]: empty }.
|
||||
return vm.throw_completion<SyntaxError>(error.to_deprecated_string());
|
||||
return vm.throw_completion<SyntaxError>(TRY_OR_THROW_OOM(vm, error.to_string()));
|
||||
}
|
||||
|
||||
// 5. Let status be ScriptEvaluation(s).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue