Skip to content

Walk the cause chain when dumping uncaught errors#1509

Merged
saghul merged 2 commits into
masterfrom
dump-error-cause-chain
May 25, 2026
Merged

Walk the cause chain when dumping uncaught errors#1509
saghul merged 2 commits into
masterfrom
dump-error-cause-chain

Conversation

@saghul
Copy link
Copy Markdown
Contributor

@saghul saghul commented May 22, 2026

Example:

var e = new Error('inner!');

throw new Error('outer!', { cause: e });
$ ./build/qjs t.js
Error: outer!
    at <anonymous> (t.js:3:11)

Caused by: Error: inner!
    at <anonymous> (t.js:1:12)

Copy link
Copy Markdown
Contributor

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it should preserve rt->current_exception? Apart from that LGTM.

@saghul
Copy link
Copy Markdown
Contributor Author

saghul commented May 24, 2026

Maybe it should preserve rt->current_exception? Apart from that LGTM.

Goot point, pushed a fix that basically acts the way the previous code did with the stack property.

@saghul saghul merged commit bb45624 into master May 25, 2026
124 checks passed
@saghul saghul deleted the dump-error-cause-chain branch May 25, 2026 07:39
qr243vbi added a commit to qr243vbi/quickjs that referenced this pull request May 25, 2026
Walk the cause chain when dumping uncaught errors (quickjs-ng#1509)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants