-
Notifications
You must be signed in to change notification settings - Fork 479
fix: add name property to exported interface errors #2446
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
Conversation
nodejs/node#40692 (comment) has some relevant discussions about custom AbortError's too. Also some deets in ipfs/helia-verified-fetch#25 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fetch spec says things like:
Let fallbackError be an "AbortError" DOMException.
...so I think longer term, in order to be closer to the spec, this class should be changed to extend DOMException
instead of Error
, then we get the .name
property for free.
DOMException was added to Node.js in v17 so we are good to use it.
Unfortunately .code
on DOMException is a number
and not a string
so it may be a breaking change, I'm not sure if we can override that for compatibilities sake, it may need testing out locally first.
Sorry, missed this - yes, I think we should. |
Ok I'll update the pr |
Just noticed that DOMException officially doesn't have a |
Description
As discussed in ipfs/helia-verified-fetch#25 (comment), this PR adds the name property to the AbortError type.
This has a couple of benefits:
Notes & open questions
Change checklist