mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 12:07:14 +02: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:
Notes:
sideshowbarker
2024-07-17 02:38:39 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/88814acbd3 Pull-request: https://github.com/SerenityOS/serenity/pull/17494 Reviewed-by: https://github.com/linusg ✅
@@ -44,7 +44,7 @@ void report_exception_to_console(JS::Value value, JS::Realm& realm, ErrorInPromi
|
||||
dbgln("\033[31;1mUnhandled JavaScript exception{}:\033[0m {}", error_in_promise == ErrorInPromise::Yes ? " (in promise)" : "", value);
|
||||
}
|
||||
|
||||
console.report_exception(*JS::Error::create(realm, value.to_string_without_side_effects().release_value_but_fixme_should_propagate_errors().to_deprecated_string()), error_in_promise == ErrorInPromise::Yes);
|
||||
console.report_exception(*JS::Error::create(realm, value.to_string_without_side_effects().release_value_but_fixme_should_propagate_errors()), error_in_promise == ErrorInPromise::Yes);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/#report-the-exception
|
||||
|
||||
Reference in New Issue
Block a user