Skip to content

Conversation

@mhdawson
Copy link
Member

@mhdawsonmhdawson commented May 9, 2017

Convert lib/dgram.js over to using lib/internal/errors.js
for generating Errors. See using-internal-errors.md for more details.

I have not addressed the cases that use errnoException() and
exceptionWithHostPort() helper methods as changing these would require
fixing the tests across all of the different files that use them. In
addition, these helpers already add a code to the Error and we'll
have to discuss how that interacts with the code used by
lib/internal/errors.js. I believe we should convert all users
of errnoException and exceptionWithHostPort in a PR dedicated to
that conversion.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows [commit guidelines]
Affected core subsystem(s)

dgram

@nodejs-github-botnodejs-github-bot added dgram Issues and PRs related to the dgram subsystem / UDP. errors Issues and PRs related to JavaScript errors originated in Node.js core. labels May 9, 2017
@mhdawsonmhdawson requested a review from jasnellMay 9, 2017 18:32
@thefourtheye
Copy link
Contributor

It shows there is a merge conflict in doc/api/errors.md

lib/dgram.js Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should probably be a TypeError as well as the other errors thrown in the sendTo function.

Copy link
MemberAuthor

@mhdawsonmhdawsonMay 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I held off changing the types of errors as that may be more breaking than just changing the message. @jasnell what's your take on that front ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would go ahead and change the type as appropriate. It's already a breaking change, we might as well rip the bandaid off all at once.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok will change

@mhdawsonmhdawson added the semver-major PRs that contain breaking changes and should be released in the next major version. label May 9, 2017
@mhdawson
Copy link
MemberAuthor

@thefourtheye thanks for pointing that out, rebased.

lib/dgram.js Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be passed in as ['string', 'falsy']

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will update

@mhdawson
Copy link
MemberAuthor

@jasnell, @BridgeAR pushed commit to address comments.

lib/dgram.js Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a TypeError.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a TypeError.

My immediate reaction was to disagree on the grounds that aTypeError means an argument is the wrong type, not missing.

But TypeError is what V8 uses for similar situations, so I'm inclined to agree that Node.js should do the same.

> [0,1,2].forEach()TypeError: undefined is not a function ... >

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think as long as we are consistent across the board, then I'm ok based on the example set by v8

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we already use TypeError in other tests in this case as well. So TypeError is the way to go.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will Fix.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Trott fixed.

lib/dgram.js Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a TypeError.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will Fix.

@mhdawson
Copy link
MemberAuthor

@BridgeAR thanks for catching those additional TypeErrors, pushed commit to address comment.

@mhdawson
Copy link
MemberAuthor

@jasnell all comments so far should be addressed.

@mhdawson
Copy link
MemberAuthor

@nodejs/ctc I believe I need a second CTC reviewer since this is semver major.

@mhdawson
Copy link
MemberAuthor

@thefourtheye any chance you can take another look ?

lib/dgram.js Outdated
Copy link
Member

@fhinkelfhinkelMay 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in multicastAddress.

lib/dgram.js Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same typo.

lib/dgram.js Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we usually starting all comments with a capital letter and . at the end?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in Aaddress.

Copy link
Member

@fhinkelfhinkelMay 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more 😉

Copy link
Member

@fhinkelfhinkel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with the Aaddress typo. Thanks!

@mhdawson
Copy link
MemberAuthor

@fhinkel thanks for the review. Will fix those up today.

@mhdawson
Copy link
MemberAuthor

@fhinkel pushed commit to address comments. Do you think I should go ahead and land this or wait for the other older PRs to land first. There are sure to be conflicts between them.

@fhinkel
Copy link
Member

Go ahead and land. We'll rebase the older PRs accordingly.

@mhdawson
Copy link
MemberAuthor

@mhdawson
Copy link
MemberAuthor

mhdawson commented May 23, 2017

See there are already conflicts. Will fix those up.

Covert lib/dgram.js over to using lib/internal/errors.js for generating Errors. See [using-internal-errors.md](https://github.com/nodejs/node/blob/master/doc/guides/using-internal-errors.md) for more details. I have not addressed the cases that use errnoException() and exceptionWithHostPort() helper methods as changing these would require fixing the tests across all of the different files that use them. In addition, these helpers already add a `code` to the Error and we'll have to discuss how that interacts with the `code` used by lib/internal/errors.js. I believe we should convert all users of errnoException and exceptionWithHostPort in a PR dedicated to that conversion.
@mhdawson
Copy link
MemberAuthor

rebased and squashed commit for comments.

@mhdawson
Copy link
MemberAuthor

@mhdawson
Copy link
MemberAuthor

Landed as e912c67

mhdawson added a commit that referenced this pull request May 24, 2017
Covert lib/dgram.js over to using lib/internal/errors.js for generating Errors. See [using-internal-errors.md](https://github.com/nodejs/node/blob/master/doc/guides/using-internal-errors.md) for more details. I have not addressed the cases that use errnoException() and exceptionWithHostPort() helper methods as changing these would require fixing the tests across all of the different files that use them. In addition, these helpers already add a `code` to the Error and we'll have to discuss how that interacts with the `code` used by lib/internal/errors.js. I believe we should convert all users of errnoException and exceptionWithHostPort in a PR dedicated to that conversion. PR-URL: #12926 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
jasnell pushed a commit that referenced this pull request May 24, 2017
Covert lib/dgram.js over to using lib/internal/errors.js for generating Errors. See [using-internal-errors.md](https://github.com/nodejs/node/blob/master/doc/guides/using-internal-errors.md) for more details. I have not addressed the cases that use errnoException() and exceptionWithHostPort() helper methods as changing these would require fixing the tests across all of the different files that use them. In addition, these helpers already add a `code` to the Error and we'll have to discuss how that interacts with the `code` used by lib/internal/errors.js. I believe we should convert all users of errnoException and exceptionWithHostPort in a PR dedicated to that conversion. PR-URL: #12926 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
jasnell pushed a commit that referenced this pull request May 28, 2017
Covert lib/dgram.js over to using lib/internal/errors.js for generating Errors. See [using-internal-errors.md](https://github.com/nodejs/node/blob/master/doc/guides/using-internal-errors.md) for more details. I have not addressed the cases that use errnoException() and exceptionWithHostPort() helper methods as changing these would require fixing the tests across all of the different files that use them. In addition, these helpers already add a `code` to the Error and we'll have to discuss how that interacts with the `code` used by lib/internal/errors.js. I believe we should convert all users of errnoException and exceptionWithHostPort in a PR dedicated to that conversion. PR-URL: #12926 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
@jasnelljasnell mentioned this pull request May 28, 2017
@mhdawsonmhdawson deleted the messages1 branch June 28, 2017 19:23
refack pushed a commit to pmatzavin/node that referenced this pull request Aug 31, 2017
covert lib/fs.js over to using lib/internal/errors.js i have not addressed the cases that use errnoException(), for reasons described in nodejsGH-12926 - throw the ERR_INVALID_CALLBACK error when the the callback is invalid - replace the ['object', 'string'] with ['string', 'object'] in the error constructor call, to better match the previous err msg in the getOptions() function - add error ERR_VALUE_OUT_OF_RANGE in lib/internal/errors.js, this error is thrown when a numeric value is out of range - document the ERR_VALUE_OUT_OF_RANGE err in errors.md - correct the expected args, in the error thrown in the function fs._toUnixTimestamp() to ['Date', 'time in seconds'] (lib/fs.js) - update the listener error type in the fs.watchFile() function, from Error to TypeError (lib/fs.js) - update errors from ERR_INVALID_OPT_VALUE to ERR_INVALID_ARG_TYPE in the functions fs.ReadStream() and fs.WriteStream(), for the cases of range errors use the new error: ERR_VALUE_OUT_OF_RANGE (lib/fs.js) PR-URL: nodejs#15043 Refs: nodejs#11273 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
refack pushed a commit to refack/node that referenced this pull request Aug 31, 2017
covert lib/fs.js over to using lib/internal/errors.js i have not addressed the cases that use errnoException(), for reasons described in nodejsGH-12926 - throw the ERR_INVALID_CALLBACK error when the the callback is invalid - replace the ['object', 'string'] with ['string', 'object'] in the error constructor call, to better match the previous err msg in the getOptions() function - add error ERR_VALUE_OUT_OF_RANGE in lib/internal/errors.js, this error is thrown when a numeric value is out of range - document the ERR_VALUE_OUT_OF_RANGE err in errors.md - correct the expected args, in the error thrown in the function fs._toUnixTimestamp() to ['Date', 'time in seconds'] (lib/fs.js) - update the listener error type in the fs.watchFile() function, from Error to TypeError (lib/fs.js) - update errors from ERR_INVALID_OPT_VALUE to ERR_INVALID_ARG_TYPE in the functions fs.ReadStream() and fs.WriteStream(), for the cases of range errors use the new error: ERR_VALUE_OUT_OF_RANGE (lib/fs.js) PR-URL: nodejs#15043 Refs: nodejs#11273 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
addaleax pushed a commit to addaleax/node that referenced this pull request Sep 13, 2017
covert lib/fs.js over to using lib/internal/errors.js i have not addressed the cases that use errnoException(), for reasons described in nodejsGH-12926 - throw the ERR_INVALID_CALLBACK error when the the callback is invalid - replace the ['object', 'string'] with ['string', 'object'] in the error constructor call, to better match the previous err msg in the getOptions() function - add error ERR_VALUE_OUT_OF_RANGE in lib/internal/errors.js, this error is thrown when a numeric value is out of range - document the ERR_VALUE_OUT_OF_RANGE err in errors.md - correct the expected args, in the error thrown in the function fs._toUnixTimestamp() to ['Date', 'time in seconds'] (lib/fs.js) - update the listener error type in the fs.watchFile() function, from Error to TypeError (lib/fs.js) - update errors from ERR_INVALID_OPT_VALUE to ERR_INVALID_ARG_TYPE in the functions fs.ReadStream() and fs.WriteStream(), for the cases of range errors use the new error: ERR_VALUE_OUT_OF_RANGE (lib/fs.js) PR-URL: nodejs#15043 Refs: nodejs#11273 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
jasnell pushed a commit to pmatzavin/node that referenced this pull request Sep 25, 2017
Covert lib/net.js over to using lib/internal/errors.js Ref: nodejs#11273 I have not addressed the cases that use errnoException(), for reasons described in nodejsGH-12926 - Replace thrown errors in lib/net.js with errors from lib/internal/errors. The ERR_INVALID_OPT_VALUE error have been used in the Server.prototype.listen() method after a discussion in Ref: nodejs#14782 - Update tests according to the above modifications
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dgramIssues and PRs related to the dgram subsystem / UDP.errorsIssues and PRs related to JavaScript errors originated in Node.js core.semver-majorPRs that contain breaking changes and should be released in the next major version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@mhdawson@thefourtheye@fhinkel@jasnell@Trott@BridgeAR@nodejs-github-bot