-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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, repl: migrate to use internal/errors.js #11347
Conversation
doc/api/errors.md
Outdated
<a id="ERR_REPL_OLD_HISTORY_PARSING_ERROR"></a> | ||
### ERR_REPL_OLD_HISTORY_PARSING_ERROR | ||
|
||
The `'ERR_REPL_OLD_HISTORY_PARSING_ERROR'` error code is used when parsing |
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.
Probably ERR_INVALID_OLD_REPL_HISTORY
? The _ERROR
at the end is unnecessary.
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.
You are right, fixed it. Thanks!
doc/api/errors.md
Outdated
<a id="ERR_REPL_INVALID_EVAL_CONFIG"></a> | ||
### ERR_REPL_INVALID_EVAL_CONFIG | ||
|
||
The `'ERR_REPL_INVALID_EVAL_CONFIG'` error code is used when both |
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 error being thrown in the code is in fact ERR_INVALID_REPL_EVAL_CONFIG
(REPL
and INVALID
are switched).
Also I think s/config/options
because that's what is written down in the docs, and those are in fact optional? ERR_INVALID_REPL_EVAL_OPTION
with the current error message should be better.
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 rationale behind the two codes was to group the REPL-related errors together. However your points are very valid, so I fixed it according to your suggestions. Thank you very much for your feedback!
0c2b0a3
to
8ee295e
Compare
doc/api/errors.md
Outdated
|
||
The `'ERR_INVALID_REPL_EVAL_OPTION'` error code is used when both | ||
`breakEvalOnSigint` and `eval` options are set in the REPL config. | ||
Allowing both of these would be confusing as `breakEvalOnSigint` |
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.
Is confusing
the right word here?
How about something like this?
The 'ERR_INVALID_REPL_EVAL_OPTION'
error code is used when both
breakEvalOnSigint
and eval
options are set in the REPL config, which is not supported.
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.
I was trying to explain the rationale of it not being supported, but you are right, it is not the place to do it. I changed the formulation.
@no23reason Thanks so much for putting this together. Sorry that it is dragging out for so long due to being a semver-major change. Could you rebase and also squash your commits (I think all the changes should be one commit, right?). Thanks! |
No problem, I'll get to it tomorrow afternoon. Thank you for your responses!
|
@fhinkel I rebased, squashed and implemented the change you proposed.
I'm not sure how to proceed now, can you please help me? |
@no23reason Fired up a CI to see how it goes anyway: |
@no23reason can you help me with the error you're getting for this test?
Ref: #13064 |
OK, so today I tried the build again on a clean checkout of the repo and suddenly all the tests pass except the |
NP. Dirty builds happen all the time 🤷♂️ ... Especially on Windows |
doc/api/errors.md
Outdated
[online]: http://man7.org/linux/man-pages/man3/errno.3.html | ||
[stream-based]: stream.html | ||
[syscall]: http://man7.org/linux/man-pages/man2/syscall.2.html | ||
[try-catch]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch | ||
[vm]: vm.html | ||
[vm]: vm.html |
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.
Accidental change?
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.
Yes, my editor trolled me a bit, I fixed it, thank you!
doc/api/errors.md
Outdated
@@ -801,8 +814,9 @@ likely an indication of a bug within Node.js itself. | |||
[domains]: domain.html | |||
[event emitter-based]: events.html#events_class_eventemitter | |||
[file descriptors]: https://en.wikipedia.org/wiki/File_descriptor | |||
[Node.js Error Codes]: #nodejs-error-codes |
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.
This is a duplicate of an existing ref..
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.
Thanks, good catch, I removed it
lib/internal/errors.js
Outdated
@@ -136,6 +138,8 @@ E('ERR_IPC_DISCONNECTED', 'IPC channel is already disconnected'); | |||
E('ERR_IPC_ONE_PIPE', 'Child process can have only one IPC pipe'); | |||
E('ERR_IPC_SYNC_FORK', 'IPC cannot be used with synchronous forks'); | |||
E('ERR_MISSING_ARGS', missingArgs); | |||
E('ERR_INVALID_REPL_EVAL_OPTION', | |||
'Cannot specify both breakEvalOnSigint and eval for REPL'); |
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.
Can you put the new codes in as close to alphabetic order as possible :-)
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.
Of course, sorry I missed it :)
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 with a nit
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
#13299 has already landed so unfortunately we can not get this PR in anymore . Thanks for the contribution anyway! |
Oh, looks like #13299 only contains part of what this PR does, so this still adds something that isn't in the codebase yet. @no23reason can do a rebase again? Thanks! |
@joyeecheung I rebased and removed the error code that is now obsolete. |
doc/api/errors.md
Outdated
<a id="ERR_INVALID_REPL_EVAL_CONFIG"></a> | ||
### ERR_INVALID_REPL_EVAL_CONFIG | ||
|
||
The `'ERR_INVALID_REPL_EVAL_CONFIG'` error code is used when both |
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.
Please change this to be consistent with #13627 ("Used when both...").
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.
I changed it, thank you for pointing me to the PR :)
lib/internal/errors.js
Outdated
@@ -129,6 +129,8 @@ E('ERR_INVALID_OPT_VALUE', | |||
(name, value) => { | |||
return `The value "${String(value)}" is invalid for option "${name}"`; | |||
}); | |||
E('ERR_INVALID_REPL_EVAL_CONFIG', | |||
'Cannot specify both breakEvalOnSigint and eval for REPL'); |
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.
I think we agreed to use quotation marks around parameter names in error message ('Cannot specify both "breakEvalOnSigint" and "eval" for REPL'
), see #1220 (or literally three lines above in errors.js
). I am not 100% sure whether this applies here, can someone confirm?
Anyway, that would make this PR semver-major, so feel free to ignore it in order to get your PR in soon :)
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.
I was using the original text of the error, but I agree that it should use the quotation marks (I wasn't aware of the convention). Thanks!
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.
Thank you for fixing it quickly! As I said before, this will (sadly) make this PR semver-major, meaning that we probably won't be able to release it before node 9.
Edit: Nevermind, I just noticed this PR was labelled as semver-major already, even though I have no idea why.
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.
It's ok :) It was labelled as such even before the 8.0 came out so I guess it kind of stuck there...
* Use existing errors where suitable * Assign code to a REPL specific error * Include documentation for the new error code
CI before merging: https://ci.nodejs.org/job/node-test-pull-request/8661/ |
For my bookkeeping: #13686 |
* Use existing errors where suitable * Assign code to a REPL specific error * Include documentation for the new error code PR-URL: nodejs#11347 Ref: nodejs#11273 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Landed in aff8d35, thank you for your first contribution! 🎉 We'd be happy to see more! (And sorry for closing this prematurely, mixed this up with another PR.) |
@tniessen Thank you for your patience and advice, I hope my next contributions will be smoother :) |
Migrated
repl
andinternal/repl
tointernal/errors
. Uses some code from #11294 as recommended in #11273.@jasnell, pinging you for mentoring as this is my first PR to this project, thank you!
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
errors, REPL