-
Notifications
You must be signed in to change notification settings - Fork 284
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
Error.name vs Error.code #789
Comments
For core, especially given that we are still in the process of migrating errors, use |
Answer part 2 .... unfortunately many errors cannot be determined just by their name and require looking into the error message to understand what happened... which is why we're introducing |
Thanks for responding :) I see. What about it for people building their own applications in Node.js and aiming at programmatically identifying the errors their own code creates? Would the node.js team encourage using |
Our goal is to make the
We are working on a good error handling strategy. There has already been a similar question at nodejs/node#15057 and the discussion is being continued in nodejs/CTC#173. |
@tniessen Awesome, thanks for the reference 👍 |
There seem to be an ongoing effort in node.js for getting any error thrown by the code functions to have a
code
property (see this pull request or this issue for example).As a node.js user, I'm used to use the
name
property to programmatically identify errors in the code I write. For example,Although the
name
property is not mentioned in Node.js documentation about Errors, it is a standard property and Node.js documentation about Errors tells us the following:Now that the
code
is property is mentioned in Node.js documentation, I am wondering which ofcode
andname
I should use as a user for programmatically identifying errors.Is there anything one should be aware of? Does the node.js team encourage for the use of one over the other?
The text was updated successfully, but these errors were encountered: