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

fix(core): error registration could pollute constructors #10422

Merged

Conversation

AaronO
Copy link
Contributor

@AaronO AaronO commented Apr 29, 2021

Our previous approach would pollute constructors (e.g: DOMExceptionOperationError) and thus break certain type checks.

Notes

One downside to this approach is that it adds an extra line to stacktraces:

❯ deno eval "Deno.openSync(null)"
error: Uncaught TypeError: Error parsing args: serde_v8 error: ExpectedString
Deno.openSync(null)
     ^
    at unwrapOpResult (deno:core/core.js:99:13)
    at Object.opSync (deno:core/core.js:113:12)
    at Object.openSync (deno:runtime/js/40_files.js:32:22)
    at file:https:///Users/aaron/git/deno/$deno$eval.ts:1:6

~/git/deno core/fix-complex-error-registration*
❯ ./target/debug/deno eval "Deno.openSync(null)"
error: Uncaught TypeError: Error parsing args: serde_v8 error: ExpectedString
Deno.openSync(null)
     ^
    at deno:core/core.js:86:60
    at unwrapOpResult (deno:core/core.js:106:13)
    at Object.opSync (deno:core/core.js:120:12)
    at Object.openSync (deno:runtime/js/40_files.js:32:22)
    at file:https:///Users/aaron/git/deno/$deno$eval.ts:1:6

So maybe the args list is the lesser evil

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

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

I'm a bit confused about the purpose of this.

Our previous approach would pollute constructors (e.g: DOMExceptionOperationError) and thus break certain type checks.

Break what type checks? Is this fixing a bug - is there a test that could be added?

Copy link
Member

@lucacasonato lucacasonato left a comment

Choose a reason for hiding this comment

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

Thanks. I have added a regression test. This unblocks #7819.

@lucacasonato lucacasonato merged commit d213807 into denoland:main May 3, 2021
@AaronO AaronO deleted the core/fix-complex-error-registration branch May 3, 2021 16:20
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.

None yet

3 participants