1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:27:45 +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:
Simon Wanner 2023-10-31 21:55:17 +01:00 committed by Andreas Kling
parent 2fb0cede9a
commit 93908fcbcb
6 changed files with 52 additions and 78 deletions

View file

@ -22,6 +22,11 @@ struct TracebackFrame {
mutable Variant<SourceRange, UnrealizedSourceRange> source_range_storage;
};
enum CompactTraceback {
No,
Yes,
};
class Error : public Object {
JS_OBJECT(Error, Object);
@ -32,7 +37,7 @@ public:
virtual ~Error() override = default;
[[nodiscard]] String stack_string() const;
[[nodiscard]] String stack_string(CompactTraceback compact = CompactTraceback::No) const;
ThrowCompletionOr<void> install_error_cause(Value options);