GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||
GeezerVison is showing github.com — errors: move error creation helpers to internal/errors.js by joyeecheung · Pull Request #18546 · nodejs/node Conversation
Member
util: skip type checks in internal getSystemErrorName fs: do not call new when creating uvException We cannot make uvException a proper class due to compatibility errors: move error creation helpers to errors.js This commit moves error creation helpers scattered around
Checklist
Affected core subsystem(s)errors, util
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsWe cannot make uvException a proper class due to compatibility reasons for now, so there is no need to call new since it only returns a newly-created Error. This commit moves error creation helpers scattered around under lib/ into lib/internal/errors.js in the hope of being clearer about the differences of errors that we throw into the user land. - Move util._errnoException and util._exceptionWithHostPort into internal/errors.js and simplify their logic so it's clearer what the properties these helpers create. - Move the errnoException helper in dns.js to internal/errors.js into internal/errors.js and rename it to dnsException. Simplify it's logic so it no longer calls errnoException and skips the unnecessary argument checks.
joyeecheung
commented
|
|
|
||
| const ex = new Error(message); | ||
| // TODO(joyeecheung): errno is supposed to err, like in uvException | ||
| ex.code = ex.errno = code; |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
In general, errors thrown by net and dns present this weird behavior (both err.code and err.errno are the string name of the error), while errors thrown by fs have a numeric err.errno and a string err.code, which is more correct IMO (otherwise why bother duplicating the info in another property? Also the name errno means it's supposed to be a number) We might want to revisit this and see how big the breakage would be if we make err.errno numeric.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
CI: https://ci.nodejs.org/job/node-test-pull-request/12916/ cc @jasnell |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
CI before landing https://ci.nodejs.org/job/node-test-pull-request/12989/ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Landed in bff5d5b...c0762c2, thanks! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
PR-URL: #18546 Reviewed-By: James M Snell <[email protected]>
We cannot make uvException a proper class due to compatibility reasons for now, so there is no need to call new since it only returns a newly-created Error. PR-URL: #18546 Reviewed-By: James M Snell <[email protected]>
This commit moves error creation helpers scattered around under lib/ into lib/internal/errors.js in the hope of being clearer about the differences of errors that we throw into the user land. - Move util._errnoException and util._exceptionWithHostPort into internal/errors.js and simplify their logic so it's clearer what the properties these helpers create. - Move the errnoException helper in dns.js to internal/errors.js into internal/errors.js and rename it to dnsException. Simplify it's logic so it no longer calls errnoException and skips the unnecessary argument checks. PR-URL: #18546 Reviewed-By: James M Snell <[email protected]>
|
Should this be backported to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
PR-URL: nodejs#18546 Reviewed-By: James M Snell <[email protected]>
This commit moves error creation helpers scattered around under lib/ into lib/internal/errors.js in the hope of being clearer about the differences of errors that we throw into the user land. - Move util._errnoException and util._exceptionWithHostPort into internal/errors.js and simplify their logic so it's clearer what the properties these helpers create. - Move the errnoException helper in dns.js to internal/errors.js into internal/errors.js and rename it to dnsException. Simplify it's logic so it no longer calls errnoException and skips the unnecessary argument checks. PR-URL: nodejs#18546 Reviewed-By: James M Snell <[email protected]>
Backport-PR-URL: #18916 PR-URL: #18546 Reviewed-By: James M Snell <[email protected]>
This commit moves error creation helpers scattered around under lib/ into lib/internal/errors.js in the hope of being clearer about the differences of errors that we throw into the user land. - Move util._errnoException and util._exceptionWithHostPort into internal/errors.js and simplify their logic so it's clearer what the properties these helpers create. - Move the errnoException helper in dns.js to internal/errors.js into internal/errors.js and rename it to dnsException. Simplify it's logic so it no longer calls errnoException and skips the unnecessary argument checks. Backport-PR-URL: #18916 PR-URL: #18546 Reviewed-By: James M Snell <[email protected]>
Backport-PR-URL: #18916 PR-URL: #18546 Reviewed-By: James M Snell <[email protected]>
This commit moves error creation helpers scattered around under lib/ into lib/internal/errors.js in the hope of being clearer about the differences of errors that we throw into the user land. - Move util._errnoException and util._exceptionWithHostPort into internal/errors.js and simplify their logic so it's clearer what the properties these helpers create. - Move the errnoException helper in dns.js to internal/errors.js into internal/errors.js and rename it to dnsException. Simplify it's logic so it no longer calls errnoException and skips the unnecessary argument checks. Backport-PR-URL: #18916 PR-URL: #18546 Reviewed-By: James M Snell <[email protected]>
PR-URL: nodejs#18546 Reviewed-By: James M Snell <[email protected]>
This commit moves error creation helpers scattered around under lib/ into lib/internal/errors.js in the hope of being clearer about the differences of errors that we throw into the user land. - Move util._errnoException and util._exceptionWithHostPort into internal/errors.js and simplify their logic so it's clearer what the properties these helpers create. - Move the errnoException helper in dns.js to internal/errors.js into internal/errors.js and rename it to dnsException. Simplify it's logic so it no longer calls errnoException and skips the unnecessary argument checks. PR-URL: nodejs#18546 Reviewed-By: James M Snell <[email protected]>
PR-URL: nodejs#18546 Reviewed-By: James M Snell <[email protected]>
We cannot make uvException a proper class due to compatibility reasons for now, so there is no need to call new since it only returns a newly-created Error. PR-URL: nodejs#18546 Reviewed-By: James M Snell <[email protected]>
This commit moves error creation helpers scattered around under lib/ into lib/internal/errors.js in the hope of being clearer about the differences of errors that we throw into the user land. - Move util._errnoException and util._exceptionWithHostPort into internal/errors.js and simplify their logic so it's clearer what the properties these helpers create. - Move the errnoException helper in dns.js to internal/errors.js into internal/errors.js and rename it to dnsException. Simplify it's logic so it no longer calls errnoException and skips the unnecessary argument checks. PR-URL: nodejs#18546 Reviewed-By: James M Snell <[email protected]>
Backport-PR-URL: #19191 PR-URL: #18546 Reviewed-By: James M Snell <[email protected]>
This commit moves error creation helpers scattered around under lib/ into lib/internal/errors.js in the hope of being clearer about the differences of errors that we throw into the user land. - Move util._errnoException and util._exceptionWithHostPort into internal/errors.js and simplify their logic so it's clearer what the properties these helpers create. - Move the errnoException helper in dns.js to internal/errors.js into internal/errors.js and rename it to dnsException. Simplify it's logic so it no longer calls errnoException and skips the unnecessary argument checks. Backport-PR-URL: #19191 PR-URL: #18546 Reviewed-By: James M Snell <[email protected]>
Backport-PR-URL: #19191 PR-URL: #18546 Reviewed-By: James M Snell <[email protected]>
This commit moves error creation helpers scattered around under lib/ into lib/internal/errors.js in the hope of being clearer about the differences of errors that we throw into the user land. - Move util._errnoException and util._exceptionWithHostPort into internal/errors.js and simplify their logic so it's clearer what the properties these helpers create. - Move the errnoException helper in dns.js to internal/errors.js into internal/errors.js and rename it to dnsException. Simplify it's logic so it no longer calls errnoException and skips the unnecessary argument checks. Backport-PR-URL: #19191 PR-URL: #18546 Reviewed-By: James M Snell <[email protected]>
Backport-PR-URL: #19191 PR-URL: #18546 Reviewed-By: James M Snell <[email protected]>
This commit moves error creation helpers scattered around under lib/ into lib/internal/errors.js in the hope of being clearer about the differences of errors that we throw into the user land. - Move util._errnoException and util._exceptionWithHostPort into internal/errors.js and simplify their logic so it's clearer what the properties these helpers create. - Move the errnoException helper in dns.js to internal/errors.js into internal/errors.js and rename it to dnsException. Simplify it's logic so it no longer calls errnoException and skips the unnecessary argument checks. Backport-PR-URL: #19191 PR-URL: #18546 Reviewed-By: James M Snell <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.