mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:08:11 +00:00
LibJS: Dump a JavaScript backtrace when throwing exceptions
This commit is contained in:
parent
2db2b8b0ef
commit
72df9c7417
1 changed files with 7 additions and 0 deletions
|
@ -219,6 +219,13 @@ Value Interpreter::throw_exception(Exception* exception)
|
||||||
if (exception->value().is_object() && exception->value().as_object().is_error()) {
|
if (exception->value().is_object() && exception->value().as_object().is_error()) {
|
||||||
auto& error = static_cast<Error&>(exception->value().as_object());
|
auto& error = static_cast<Error&>(exception->value().as_object());
|
||||||
dbg() << "Throwing JavaScript Error: " << error.name() << ", " << error.message();
|
dbg() << "Throwing JavaScript Error: " << error.name() << ", " << error.message();
|
||||||
|
|
||||||
|
for (ssize_t i = m_call_stack.size() - 1; i >= 0; --i) {
|
||||||
|
auto function_name = m_call_stack[i].function_name;
|
||||||
|
if (function_name.is_empty())
|
||||||
|
function_name = "<anonymous>";
|
||||||
|
dbg() << " " << function_name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m_exception = exception;
|
m_exception = exception;
|
||||||
unwind(ScopeType::Try);
|
unwind(ScopeType::Try);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue