mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 09:49:15 +03:00
LibJS: Log any exception, not just the ones with a JS::Error value
This was super confusing as we would check if the exception's value is a JS::Error and not log it otherwise, even with m_should_log_exceptions set. As a result, things like DOM exceptions were invisible to us with execution just silently stopping, for example.
This commit is contained in:
parent
f1fde01025
commit
55d9f1cced
Notes:
sideshowbarker
2024-07-18 20:52:09 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/55d9f1cced2 Pull-request: https://github.com/SerenityOS/serenity/pull/6090
@ -292,9 +292,14 @@ Value VM::construct(Function& function, Function& new_target, Optional<MarkedVal
|
||||
|
||||
void VM::throw_exception(Exception* exception)
|
||||
{
|
||||
if (should_log_exceptions() && exception->value().is_object() && is<Error>(exception->value().as_object())) {
|
||||
auto& error = static_cast<Error&>(exception->value().as_object());
|
||||
dbgln("Throwing JavaScript Error: {}, {}", error.name(), error.message());
|
||||
if (should_log_exceptions()) {
|
||||
auto value = exception->value();
|
||||
if (value.is_object() && is<Error>(value.as_object())) {
|
||||
auto& error = static_cast<Error&>(value.as_object());
|
||||
dbgln("Throwing JavaScript exception: [{}] {}", error.name(), error.message());
|
||||
} else {
|
||||
dbgln("Throwing JavaScript exception: {}", value);
|
||||
}
|
||||
|
||||
for (ssize_t i = m_call_stack.size() - 1; i >= 0; --i) {
|
||||
const auto& source_range = m_call_stack[i]->current_node->source_range();
|
||||
|
Loading…
Reference in New Issue
Block a user