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

Tracking issue: Migrate errors to internal/errors.js #17709

Closed
joyeecheung opened this Issue Dec 16, 2017 · 21 comments

Comments

Projects
None yet
10 participants
@joyeecheung
Member

joyeecheung commented Dec 16, 2017

There are a few old-style errors added since #11273 opened. Opening a new issue to track the migration. I have excluded errors that have existing code property as changing those could result in bigger breakages.

On how to migrate those errors, see the guide: Using the internal/errors.js Module

  • lib/_http_outgoing.js - #17837
    • new Error('write after end'): can be migrated to ERR_STREAM_WRITE_AFTER_END
    • new Error('Cannot pipe, not readable')): can be migrated to ERR_STREAM_CANNOT_PIPE
  • lib/_tls_legacy.js - #17759
    • new Error('TLS session renegotiation attack detected'): can be migrated to ERR_TLS_SESSION_ATTACK should not be migrated because it's being deprecated. Add a comment there instead.
  • lib/_tls_wrap.js - #17792
    • new Error('TLS session renegotiation disabled for this socket'): needs a new error, maybe ERR_TLS_RENEGOTIATION_DISABLED
  • lib/fs.js - #17719
    • new Error('Invalid data')): can be migrated to ERR_INVALID_ARG_TYPE
  • lib/net.js - #17766
    • new Error('This socket is closed'), cb): can be migrated to ERR_SOCKET_CLOSED
    • new Error('Not running')): needs a new error, maybe ERR_SERVER_NOT_RUNNING
  • lib/repl.js - #17716
    • new Error('Script execution interrupted.')): needs a new error, maybe ERR_SCRIPT_EXECUTION_INTERRUPTED
@joyeecheung

This comment has been minimized.

Member

joyeecheung commented Dec 16, 2017

Just like #11273 this should be a good first issue. People who want to start working on this can post a reply here, and cc @jasnell and me in the PR. There is a guide on how to migrate the errors, also please read the contributing guide on how to format the commit and the PR process. It's ok if you want to take multiple tasks in the OP but I would prefer one file per person so more people get the opportunity to start contributing to core.

The tests would almost definitely fail after the errors in lib have been changed, so please fix the tests accordingly and make sure make test passes before submitting the PR. If no tests fail after the change, please add one by following the guide

@mannanali413

This comment has been minimized.

Contributor

mannanali413 commented Dec 16, 2017

@joyeecheung @jasnell i can take these up.

@ramsgoli

This comment has been minimized.

Contributor

ramsgoli commented Dec 17, 2017

@joyeecheung @jasnell I can take one of these files as well

@acparas

This comment has been minimized.

Contributor

acparas commented Dec 17, 2017

@joyeecheung @jasnell I'd like to tackle lib/_http_outgoing.js's error migration!

@joyeecheung

This comment has been minimized.

Member

joyeecheung commented Dec 17, 2017

@ramsgoli @mannanali413 Hi, please indicate which file you are going to work on in this thread to avoid stepping over each other's toes, thanks!

@kysnm

This comment has been minimized.

Contributor

kysnm commented Dec 17, 2017

@joyeecheung @jasnell I would like to take the lib/repl.js

@kysnm kysnm referenced this issue Dec 17, 2017

Closed

repl: migrate errors to internal/errors #17716

4 of 4 tasks complete
@kysnm

This comment has been minimized.

Contributor

kysnm commented Dec 17, 2017

@joyeecheung @jasnell If anyone doesn't take the lib/net.js, I would like to take it.

@mannanali413

This comment has been minimized.

Contributor

mannanali413 commented Dec 17, 2017

@jasnell I will take up lib/_tls_wrap.js

@styfle

This comment has been minimized.

Contributor

styfle commented Dec 17, 2017

@joyeecheung @jasnell I will take lib/fs.js

@jasnell

This comment has been minimized.

Member

jasnell commented Dec 17, 2017

@styfle ... Heads up, I'm currently doing quite a bit of work in fs.js, including hitting the rest of the error codes

@styfle

This comment has been minimized.

Contributor

styfle commented Dec 17, 2017

@jasnell Should I take a different file or are you doing them all??

styfle added a commit to styfle/node that referenced this issue Dec 17, 2017

@styfle styfle referenced this issue Dec 17, 2017

Closed

lib: migrate errors to internal/errors #17719

3 of 3 tasks complete
@Xavier-J-Ortiz

This comment has been minimized.

Contributor

Xavier-J-Ortiz commented Dec 17, 2017

I'd like to have a go at _tls_legacy.js!

This would be my first contribution to an open source project if I can figure it out. :)

styfle added a commit to styfle/node that referenced this issue Dec 17, 2017

Xavier-J-Ortiz referenced this issue in Xavier-J-Ortiz/node Dec 17, 2017

@Xavier-J-Ortiz

This comment has been minimized.

Contributor

Xavier-J-Ortiz commented Dec 17, 2017

After reading the Using the internal/errors.js Module I think I got the idea.

Xavier-J-Ortiz@b251e5c

I checked to see within that internal/errors document if any tests are necessary. I didn't change the error message to be anything other than a string, so I think that should not need any tests.

I'm not sure if I owe any kind of test tests outside of this. Let me know if some test is needed for this, and I'll take a stab at writing it too, though I might need some guidance on it.

@joyeecheung

This comment has been minimized.

Member

joyeecheung commented Dec 18, 2017

@Xavier-J-Ortiz Usually the migrated error should have a test (using common.expectsError) testing that error has the expected code. The point of migrating these errors is that the users can rely on err.code instead of err.message and if the PR does not test err.code at all, we can't be sure the error is migrated properly.

Can you read the contributing guide and open a PR with your changes? Thanks!

@Xavier-J-Ortiz

This comment has been minimized.

Contributor

Xavier-J-Ortiz commented Dec 18, 2017

@joyeecheung Thank you for pointing that out.

  1. I'll read documentation, the contributing guide you pointed out, as well as try to find where the error tests are located in order to test err.code and write a test for it.

  2. you mentioned opening a PR for the changes. Should I open it right now with what I've done at the moment, or should I create the PR after I create a test.

Thanks again for the guidance so far joyeecheung !

@apapirovski

This comment has been minimized.

Member

apapirovski commented Dec 18, 2017

@joyeecheung I'm not certain if we should migrate _tls_legacy.js over. It's already deprecated (or, more accurately, the createSecurePair that is exported from there), it seems strange to potentially force users to update their code that uses it to account for a change in error. Given the length of time it has been deprecated for, it's possible we might even consider removing it in 10 or 11? Just thinking out loud here...

@joyeecheung

This comment has been minimized.

Member

joyeecheung commented Dec 19, 2017

@apapirovski That sounds reasonable to me. In that case, maybe we should add a comment there about why this is throwing old-style errors (I am planning to write a lint rule for that). @Xavier-J-Ortiz sorry for the fuss, can you change your PR to do that instead? Thanks.

@Xavier-J-Ortiz

This comment has been minimized.

Contributor

Xavier-J-Ortiz commented Dec 19, 2017

@joyeecheung Not a problem or a fuss. :)

This is the PR I created just now for this. #17759

Let me know if this is what you were thinking in terms of the comment.

Xavier-J-Ortiz added a commit to Xavier-J-Ortiz/node that referenced this issue Dec 19, 2017

tls: comment about old-style errors
Old style errors are being migrated to internal/errors.js, however, due
to depreciation of _tls_legacy.js, it isn't worth the effort to migrate
and potentially force users to update their code for this error change.

This comment clarifies the reason why this error is not migrated.

Refs:nodejs#17709 (comment)

@kysnm kysnm referenced this issue Dec 19, 2017

Closed

net: migrate errors to internal/errors #17766

4 of 4 tasks complete

Xavier-J-Ortiz added a commit to Xavier-J-Ortiz/node that referenced this issue Dec 20, 2017

tls: typo correction in error comment
Old style errors are being migrated to internal/errors.js, however, due
to depreciation of _tls_legacy.js, it isn't worth the effort to migrate
and potentially force users to update their code for this error change.

This comment clarifies the reason why this error is not migrated.
Previous commit had a typo, needed to change the word depreciated to
deprecated.

Refs:nodejs#17709 (comment)

maclover7 added a commit that referenced this issue Dec 22, 2017

tls: comment about old-style errors
Old style errors are being migrated to internal/errors.js, however, due
to depreciation of _tls_legacy.js, it isn't worth the effort to migrate
and potentially force users to update their code for this error change.

This comment clarifies the reason why this error is not migrated.

PR-URL: #17759
Refs: #17709
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>

mannanali413 added a commit to mannanali413/node that referenced this issue Dec 23, 2017

api/errors.md: Remove extra space in the message
Remove the extra space in the message corresponding to the key ERR_TLS_RENEGOTIATION_DISABLED . 
Fixes: nodejs#17709

joyeecheung added a commit that referenced this issue Dec 23, 2017

tls: migrate errors in _tls_wrap.js
This migrates the old style error in _tls_wrap.js to
the new style error ERR_TLS_RENEGOTIATION_DISABLED.

Refs: #17709

PR-URL: #17792
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>

joyeecheung added a commit that referenced this issue Dec 23, 2017

fs: migrate errors to internal/errors
Throw ERR_INVALID_ARG_TYPE when validating arguments passed to
WriteStream.prototype._write.

Refs: #17709
PR-URL: #17719
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

joyeecheung added a commit that referenced this issue Dec 23, 2017

net: migrate errors to internal/errors
Throw ERR_SOCKET_CLOSED and ERR_SERVER_NOT_RUNNING
instead of the old-style errors in net.js.

PR-URL: #17766
Refs: #17709
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

joyeecheung added a commit that referenced this issue Dec 27, 2017

lib: migrate _http_outgoing.js's remaining errors
A couple of lib/_http_outgoing.js's errors were still in the
"old style": `throw new Error(<some message here>)`.

This commit migrates those 2 old style errors to the "new style":
internal/errors.js's error-system.

In the future, changes to these errors' messages won't break
semver-major status. With the old style, changes to these errors'
messages broke semver-major status. It was inconvenient.

Refs: #17709
PR-URL: #17837
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@joyeecheung

This comment has been minimized.

Member

joyeecheung commented Dec 27, 2017

All the errors in the OP have been migrated, thanks everyone!

MylesBorins added a commit that referenced this issue Jan 8, 2018

tls: comment about old-style errors
Old style errors are being migrated to internal/errors.js, however, due
to depreciation of _tls_legacy.js, it isn't worth the effort to migrate
and potentially force users to update their code for this error change.

This comment clarifies the reason why this error is not migrated.

PR-URL: #17759
Refs: #17709
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>

MylesBorins added a commit that referenced this issue Jan 9, 2018

tls: comment about old-style errors
Old style errors are being migrated to internal/errors.js, however, due
to depreciation of _tls_legacy.js, it isn't worth the effort to migrate
and potentially force users to update their code for this error change.

This comment clarifies the reason why this error is not migrated.

PR-URL: #17759
Refs: #17709
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>

MylesBorins added a commit that referenced this issue Jan 9, 2018

tls: comment about old-style errors
Old style errors are being migrated to internal/errors.js, however, due
to depreciation of _tls_legacy.js, it isn't worth the effort to migrate
and potentially force users to update their code for this error change.

This comment clarifies the reason why this error is not migrated.

PR-URL: #17759
Refs: #17709
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>

gibfahn added a commit that referenced this issue Jan 24, 2018

tls: comment about old-style errors
Old style errors are being migrated to internal/errors.js, however, due
to depreciation of _tls_legacy.js, it isn't worth the effort to migrate
and potentially force users to update their code for this error change.

This comment clarifies the reason why this error is not migrated.

PR-URL: #17759
Refs: #17709
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>

gibfahn added a commit that referenced this issue Jan 24, 2018

tls: comment about old-style errors
Old style errors are being migrated to internal/errors.js, however, due
to depreciation of _tls_legacy.js, it isn't worth the effort to migrate
and potentially force users to update their code for this error change.

This comment clarifies the reason why this error is not migrated.

PR-URL: #17759
Refs: #17709
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>

gibfahn added a commit that referenced this issue Jan 24, 2018

tls: comment about old-style errors
Old style errors are being migrated to internal/errors.js, however, due
to depreciation of _tls_legacy.js, it isn't worth the effort to migrate
and potentially force users to update their code for this error change.

This comment clarifies the reason why this error is not migrated.

PR-URL: #17759
Refs: #17709
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>

gibfahn added a commit that referenced this issue Jan 24, 2018

tls: comment about old-style errors
Old style errors are being migrated to internal/errors.js, however, due
to depreciation of _tls_legacy.js, it isn't worth the effort to migrate
and potentially force users to update their code for this error change.

This comment clarifies the reason why this error is not migrated.

PR-URL: #17759
Refs: #17709
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>

msoechting added a commit to hpicgs/node that referenced this issue Feb 5, 2018

tls: comment about old-style errors
Old style errors are being migrated to internal/errors.js, however, due
to depreciation of _tls_legacy.js, it isn't worth the effort to migrate
and potentially force users to update their code for this error change.

This comment clarifies the reason why this error is not migrated.

PR-URL: nodejs#17759
Refs: nodejs#17709
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>

msoechting added a commit to hpicgs/node that referenced this issue Feb 5, 2018

tls: migrate errors in _tls_wrap.js
This migrates the old style error in _tls_wrap.js to
the new style error ERR_TLS_RENEGOTIATION_DISABLED.

Refs: nodejs#17709

PR-URL: nodejs#17792
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>

msoechting added a commit to hpicgs/node that referenced this issue Feb 5, 2018

fs: migrate errors to internal/errors
Throw ERR_INVALID_ARG_TYPE when validating arguments passed to
WriteStream.prototype._write.

Refs: nodejs#17709
PR-URL: nodejs#17719
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

msoechting added a commit to hpicgs/node that referenced this issue Feb 5, 2018

net: migrate errors to internal/errors
Throw ERR_SOCKET_CLOSED and ERR_SERVER_NOT_RUNNING
instead of the old-style errors in net.js.

PR-URL: nodejs#17766
Refs: nodejs#17709
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

msoechting added a commit to hpicgs/node that referenced this issue Feb 5, 2018

lib: migrate _http_outgoing.js's remaining errors
A couple of lib/_http_outgoing.js's errors were still in the
"old style": `throw new Error(<some message here>)`.

This commit migrates those 2 old style errors to the "new style":
internal/errors.js's error-system.

In the future, changes to these errors' messages won't break
semver-major status. With the old style, changes to these errors'
messages broke semver-major status. It was inconvenient.

Refs: nodejs#17709
PR-URL: nodejs#17837
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

msoechting added a commit to hpicgs/node that referenced this issue Feb 7, 2018

tls: comment about old-style errors
Old style errors are being migrated to internal/errors.js, however, due
to depreciation of _tls_legacy.js, it isn't worth the effort to migrate
and potentially force users to update their code for this error change.

This comment clarifies the reason why this error is not migrated.

PR-URL: nodejs#17759
Refs: nodejs#17709
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>

msoechting added a commit to hpicgs/node that referenced this issue Feb 7, 2018

tls: migrate errors in _tls_wrap.js
This migrates the old style error in _tls_wrap.js to
the new style error ERR_TLS_RENEGOTIATION_DISABLED.

Refs: nodejs#17709

PR-URL: nodejs#17792
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>

msoechting added a commit to hpicgs/node that referenced this issue Feb 7, 2018

fs: migrate errors to internal/errors
Throw ERR_INVALID_ARG_TYPE when validating arguments passed to
WriteStream.prototype._write.

Refs: nodejs#17709
PR-URL: nodejs#17719
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

msoechting added a commit to hpicgs/node that referenced this issue Feb 7, 2018

net: migrate errors to internal/errors
Throw ERR_SOCKET_CLOSED and ERR_SERVER_NOT_RUNNING
instead of the old-style errors in net.js.

PR-URL: nodejs#17766
Refs: nodejs#17709
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

msoechting added a commit to hpicgs/node that referenced this issue Feb 7, 2018

lib: migrate _http_outgoing.js's remaining errors
A couple of lib/_http_outgoing.js's errors were still in the
"old style": `throw new Error(<some message here>)`.

This commit migrates those 2 old style errors to the "new style":
internal/errors.js's error-system.

In the future, changes to these errors' messages won't break
semver-major status. With the old style, changes to these errors'
messages broke semver-major status. It was inconvenient.

Refs: nodejs#17709
PR-URL: nodejs#17837
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

MylesBorins added a commit that referenced this issue Feb 11, 2018

tls: comment about old-style errors
Old style errors are being migrated to internal/errors.js, however, due
to depreciation of _tls_legacy.js, it isn't worth the effort to migrate
and potentially force users to update their code for this error change.

This comment clarifies the reason why this error is not migrated.

PR-URL: #17759
Refs: #17709
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>

MylesBorins added a commit that referenced this issue Feb 12, 2018

tls: comment about old-style errors
Old style errors are being migrated to internal/errors.js, however, due
to depreciation of _tls_legacy.js, it isn't worth the effort to migrate
and potentially force users to update their code for this error change.

This comment clarifies the reason why this error is not migrated.

PR-URL: #17759
Refs: #17709
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>

MylesBorins added a commit that referenced this issue Feb 12, 2018

tls: comment about old-style errors
Old style errors are being migrated to internal/errors.js, however, due
to depreciation of _tls_legacy.js, it isn't worth the effort to migrate
and potentially force users to update their code for this error change.

This comment clarifies the reason why this error is not migrated.

PR-URL: #17759
Refs: #17709
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>

MylesBorins added a commit that referenced this issue Feb 13, 2018

tls: comment about old-style errors
Old style errors are being migrated to internal/errors.js, however, due
to depreciation of _tls_legacy.js, it isn't worth the effort to migrate
and potentially force users to update their code for this error change.

This comment clarifies the reason why this error is not migrated.

PR-URL: #17759
Refs: #17709
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment