mirror of
https://github.com/RGBCube/serenity
synced 2025-05-15 07:14:58 +00:00
LibJS+Embedders: Unify stack trace format for uncaught errors
Previously these handlers duplicated code and used formats that were different from the one Error.prototype.stack uses. Now they use the same Error::stack_string function, which accepts a new parameter for compacting stack traces with repeating frames.
This commit is contained in:
parent
2fb0cede9a
commit
93908fcbcb
6 changed files with 52 additions and 78 deletions
|
@ -31,11 +31,7 @@ void report_exception_to_console(JS::Value value, JS::Realm& realm, ErrorInPromi
|
|||
}
|
||||
if (is<JS::Error>(object)) {
|
||||
auto const& error_value = static_cast<JS::Error const&>(object);
|
||||
for (auto& traceback_frame : error_value.traceback()) {
|
||||
auto& function_name = traceback_frame.function_name;
|
||||
auto& source_range = traceback_frame.source_range();
|
||||
dbgln(" {} at {}:{}:{}", function_name, source_range.filename(), source_range.start.line, source_range.start.column);
|
||||
}
|
||||
dbgln("{}", error_value.stack_string(JS::CompactTraceback::Yes));
|
||||
console.report_exception(error_value, error_in_promise == ErrorInPromise::Yes);
|
||||
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue