-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
errors: move error codes into separate module #14250
Conversation
Would it be better to create an |
doc/guides/using-internal-errors.md
Outdated
EXAMPLE_KEY1: 'EXAMPLE_KEY1', | ||
EXAMPLE_KEY2: 'EXAMPLE_KEY2', | ||
// ... | ||
} |
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.
Linting nit: missing semicolon.
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.
fixed
30a8307
to
7610dbe
Compare
@Trott I tried to create an
|
@starkwang Ah! It looks like we may have run into a similar issue with |
7610dbe
to
ef6c0c2
Compare
Pushed commit to address comments. |
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.
Needs one small doc change but otherwise looks good to me if the CI is green.
doc/guides/using-internal-errors.md
Outdated
@@ -47,12 +47,22 @@ const err = new errors.TypeError('FOO', type); | |||
|
|||
## Adding new errors | |||
|
|||
New static error codes are added by modifying the `internal/errors.js` file | |||
and appending the new error codes to the end using the utility `E()` method. | |||
New static error codes are added by modifying the `internal/error_codes.js` file. |
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 path here needs to be updated to reflect the new location of the file.
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.
Doc fixed.
/cc @jasnell |
ef6c0c2
to
dc185e6
Compare
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.
LGTM if CI is green.
9210f2d
to
93ec771
Compare
93ec771
to
7576dd4
Compare
Ping @starkwang, this needs a rebase. |
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.
FWIW, I am -1 on this approach as it currently stands. There is no reason to move the codes to a separate file and doing so now would unnecessarily disrupt the current ongoing migration process. If we want to expose the codes as constants, then those can be dropped off the existing internal/errors
module.exports
target.
@jasnell didn't you suggest moving them to a |
Eventually, yes, but these are fairly difficult to manage as it is. Once the migration is done we can revisit. I have a few things in mind already also... |
Move error codes into a new separate module
internal/error_codes
. And theguides/using-internal-errors.md
are also changed.This PR only separate the error codes in
internal/errors.js
. I think the rest of error codes in./lib
should wait for some future PRs.Ref: #14216, #11273
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
errors