LibJS: Dump a JavaScript backtrace when throwing exceptions
This commit is contained in:
parent
2db2b8b0ef
commit
72df9c7417
Notes:
sideshowbarker
2024-07-19 07:32:31 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/72df9c74174
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()) {
|
||||
auto& error = static_cast<Error&>(exception->value().as_object());
|
||||
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;
|
||||
unwind(ScopeType::Try);
|
||||
|
|
Loading…
Add table
Reference in a new issue