-
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
lib: combine similar error codes #17648
Conversation
I'm not for or against this, but it definitely defeats the purpose of the error code movement. Theoretically, the idea is that the error message strings can change freely but the codes themselves will never change. |
@cjihrig Agreed. But I think the reduction of error codes is also important. |
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.
Not too happy about this either, but more "not happy about the fact that we have to do this" than "not happy about the fact that we are doing this".
@cjihrig as far as I see it there is still going to be some work about that but it is going to reduce a lot over time. |
I mark this as ready even though it should probably wait the full 48 hours and how do we handle error codes at the moment? Do we still require two TSC votes on it? I remember that we spoke about loosening that in Vancouver but I am not sure what happened afterwards about it. |
changing error codes is definitely server-Major and would require two TSC votes |
I haven't reviewed the code but I'm +1 on the 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.
+1, good to take care of these types of changes while new error codes are still being introduced, hopefully won't be too much ecosystem breakage.
Should this breaking change be documented somewhere, maybe the |
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 we use ERR_OUT_OF_RANGE
instead going forward? There are 4 places currently that have ERR_VALUE_OUT_OF_RANGE
compared to like 35 uses of the former.
Also, while at it, could you update to use RangeError
everywhere instead of TypeError
?
Thanks!
@apapirovski Actually there are 5 places using We use
Yes, I will fix it : ) |
There are 5 total instances of
The error message can be modified on |
I would rather use the |
I think I’d prefer Edit: Okay, in that case we might also want to call it “out of bounds”, not “out of range”… I still feel like that’s something that might be easy to mix up for non-native speakers of English |
4e412cf
to
0e23879
Compare
For The benefit of changing
IMO the introduction of |
Pushed commit to address comment. Changes are:
|
Also, this could potentially land in two separate commits:
I don't know if it's worth it but something to consider? |
doc/api/errors.md
Outdated
@@ -1568,7 +1568,7 @@ entry types were found. | |||
<a id="ERR_VALUE_OUT_OF_RANGE"></a> | |||
### ERR_VALUE_OUT_OF_RANGE | |||
|
|||
A given value is out of the accepted range. | |||
**Discarded**. It has been replaced by `ERR_OUT_OF_RANGE`. |
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 wouldn't say discarded
. Maybe just keep its description and say something like "Superseded by ERR_OUT_OF_RANGE
." Maybe this should also somehow mention the Node.js version? I don't know... we don't have a policy around this right now, do we?
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.
Should this go into the deprecations?
I'm not sure about that. The purpose of the movement was to allow the messages to be semver-patch. Actually then changing the code-meaning of the error is still semver-major just as normal. |
I don't think that's happening in this PR, is it? The meaning is still exactly the same, just with more insight. |
0e23879
to
aef3c65
Compare
aef3c65
to
94fdcc2
Compare
Rebased to resolve conflicts and fixed some broken tests. |
This needs another rebase. |
94fdcc2
to
c0cd8da
Compare
Rebased to resolve conflicts. |
There two similar error codes in lib: "ERR_VALUE_OUT_OF_RANGE" and "ERR_OUT_OF_RANGE". This change is to reduce them into "ERR_VALUE_OUT_OF_RANGE" Fixes: nodejs#17603
c0cd8da
to
05fe291
Compare
Rebased again to resolve conflicts. |
There two similar error codes in lib: "ERR_VALUE_OUT_OF_RANGE" and "ERR_OUT_OF_RANGE". This change is to reduce them into "ERR_VALUE_OUT_OF_RANGE" Fixes: #17603 PR-URL: #17648 Fixes: #17603 Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Landed in d022cb1 |
This removes two unused error codes: * ERR_STREAM_READ_NOT_IMPLEMENTED, removed in c979488 (PR nodejs#18813). * ERR_VALUE_OUT_OF_RANGE, removed in d022cb1 (PR nodejs#17648). PR-URL: nodejs#21491 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
This removes two unused error codes: * ERR_STREAM_READ_NOT_IMPLEMENTED, removed in c979488 (PR #18813). * ERR_VALUE_OUT_OF_RANGE, removed in d022cb1 (PR #17648). PR-URL: #21491 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
There two similar error codes in lib:
ERR_VALUE_OUT_OF_RANGE
andERR_OUT_OF_RANGE
. This change is to:ERR_VALUE_OUT_OF_RANGE
Fix: #17603
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)