Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): show error cause recursion information #16384

Merged
merged 15 commits into from
Oct 26, 2022

Conversation

Cre3per
Copy link
Contributor

@Cre3per Cre3per commented Oct 21, 2022

Marks recursive error causes in stringified errors, as requested in #13413, eg.

error: Uncaught Error: baz
const baz = new Error("baz", { cause: bar });
            ^
    at file:///error_cause_recursive_tail.ts:3:13
Caused by: Error: bar <ref *1>
    at file:///error_cause_recursive_tail.ts:2:13
Caused by: Error: foo
    at file:///error_cause_recursive_tail.ts:1:13
Caused by: [Circular *1]

We have to compare 2 JsError objects for equality (But not their cause) in order to find a recursive error.
That's what I added JsErrorIdentity for. I personally dislike this struct, but couldn't find a better solution. Perhaps someone familiar with deno's codebase and Rust has a better idea.

Additional changes

  • Renamed parameter of format_js_error_inner(), because it confused me more than once

@Cre3per Cre3per changed the title feat(cli): show error cause reccursion information feat(cli): show error cause recursion information Oct 21, 2022
@bartlomieju bartlomieju requested a review from crowlKats October 24, 2022 14:24
Copy link
Member

@crowlKats crowlKats left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@crowlKats crowlKats merged commit 193b882 into denoland:main Oct 26, 2022
@Cre3per Cre3per deleted the circular-cause-in-error branch October 27, 2022 15:14
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