Skip to content
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
6 tasks done
joyeecheung opened this issue Dec 16, 2017 · 21 comments
Closed
6 tasks done

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

joyeecheung opened this issue Dec 16, 2017 · 21 comments
Labels
errors Issues and PRs related to JavaScript errors originated in Node.js core. good first issue Issues that are suitable for first-time contributors. lib / src Issues and PRs related to general changes in the lib or src directory.

Comments

@joyeecheung
Copy link
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

@joyeecheung joyeecheung added errors Issues and PRs related to JavaScript errors originated in Node.js core. lib / src Issues and PRs related to general changes in the lib or src directory. good first issue Issues that are suitable for first-time contributors. labels Dec 16, 2017
@joyeecheung
Copy link
Member Author

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
Copy link
Contributor

@joyeecheung @jasnell i can take these up.

@ramsgoli
Copy link
Contributor

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

@b0yfriend
Copy link
Contributor

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

@joyeecheung
Copy link
Member Author

@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
Copy link
Contributor

kysnm commented Dec 17, 2017

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

@kysnm
Copy link
Contributor

kysnm commented Dec 17, 2017

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

@mannanali413
Copy link
Contributor

@jasnell I will take up lib/_tls_wrap.js

@styfle
Copy link
Member

styfle commented Dec 17, 2017

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

@jasnell
Copy link
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
Copy link
Member

styfle commented Dec 17, 2017

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

@Xavier-J-Ortiz
Copy link
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. :)

Xavier-J-Ortiz referenced this issue in Xavier-J-Ortiz/node Dec 17, 2017
@Xavier-J-Ortiz
Copy link
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
Copy link
Member Author

@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
Copy link
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
Copy link
Member

@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
Copy link
Member Author

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
Copy link
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
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)
maclover7 pushed a commit that referenced this issue Dec 22, 2017
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
Remove the extra space in the message corresponding to the key ERR_TLS_RENEGOTIATION_DISABLED . 
Fixes: nodejs#17709
joyeecheung pushed a commit that referenced this issue Dec 23, 2017
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 pushed a commit that referenced this issue Dec 23, 2017
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 pushed a commit that referenced this issue Dec 23, 2017
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 pushed a commit that referenced this issue Dec 27, 2017
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
Copy link
Member Author

joyeecheung commented Dec 27, 2017

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

MylesBorins pushed a commit that referenced this issue Jan 8, 2018
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 pushed a commit that referenced this issue Jan 9, 2018
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 pushed a commit that referenced this issue Jan 9, 2018
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 pushed a commit that referenced this issue Jan 24, 2018
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 pushed a commit that referenced this issue Jan 24, 2018
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 pushed a commit that referenced this issue Jan 24, 2018
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 pushed a commit that referenced this issue Feb 11, 2018
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 pushed a commit that referenced this issue Feb 12, 2018
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 pushed a commit that referenced this issue Feb 13, 2018
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
Labels
errors Issues and PRs related to JavaScript errors originated in Node.js core. good first issue Issues that are suitable for first-time contributors. lib / src Issues and PRs related to general changes in the lib or src directory.
Projects
None yet
Development

No branches or pull requests

10 participants