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

errors,tty: migrate to use internal/errors.js #13240

Closed
wants to merge 1 commit into from

Conversation

200GAUTAM
Copy link
Contributor

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

tty, errors

ref: #11273
This is my first contribution I read and understood the contribution guidelines, please review and suggest.
@jasnell
Thanks.

@nodejs-github-bot nodejs-github-bot added errors Issues and PRs related to JavaScript errors originated in Node.js core. tty Issues and PRs related to the tty subsystem. labels May 26, 2017
@@ -148,6 +148,7 @@ E('ERR_SOCKET_BAD_TYPE',
E('ERR_SOCKET_CANNOT_SEND', 'Unable to send data');
E('ERR_SOCKET_BAD_PORT', 'Port should be > 0 and < 65536');
E('ERR_SOCKET_DGRAM_NOT_RUNNING', 'Not running');
E('ERR_INVALID_FD', 'fd must be positive integer');
Copy link
Member

@Trott Trott May 26, 2017

Choose a reason for hiding this comment

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

These are supposed to be kept alphabetical. (See comment on line 112.) Of course, it doesn't help that the SOCKET ones are all after UNKNOWN and the comment says "Add new errors from here..." so not exactly your fault but if you can fix the ordering while you're in here anyway, that would be great by me.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, at this point in time it's a best effort while we get all these done. There are many separate PRs and things are going to get out of order. We need to just stay on top of making sure they get organized eventually.

Copy link
Member

Choose a reason for hiding this comment

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

To be consistent with the existing error message, something like the following would be appropriate:

E('ERR_INVALID_FD', (fd) => `"fd" must be a positive integer: ${fd}`);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Trott @jasnell code changed and thanks for the review.

@@ -38,7 +38,7 @@ function ReadStream(fd, options) {
if (!(this instanceof ReadStream))
return new ReadStream(fd, options);
if (fd >> 0 !== fd || fd < 0)
throw new RangeError('fd must be positive integer: ' + fd);
throw new errors.RangeError('ERR_INVALID_FD', fd);
Copy link
Member

Choose a reason for hiding this comment

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

You're passing the fd in as an argument but you're not using it in the error message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jasnell fixed as per your suggestion

Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

Thank you for this! Left a few comments that need to addressed before this can land

Copy link
Member

@mhdawson mhdawson 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 removal of --expose-internals from the test.

@@ -1,14 +1,18 @@
// Flags: --expose-internals
Copy link
Member

Choose a reason for hiding this comment

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

Is the --expose-internals needed here ?

@jasnell
Copy link
Member

jasnell commented Jun 2, 2017

@jasnell
Copy link
Member

jasnell commented Jun 2, 2017

The --expose-internals in the test can be removed by whomever lands this PR

@200GAUTAM
Copy link
Contributor Author

@mhdawson --expose-internals has been removed, Thanks for the review.

@200GAUTAM
Copy link
Contributor Author

@jasnell Thanks for the review , --expose-internals in the test has been removed. Thanks

@200GAUTAM
Copy link
Contributor Author

@jasnell @mhdawson
I hope I have addressed all the review comments. Please review and do the needful

@mhdawson
Copy link
Member

mhdawson commented Jun 6, 2017

@200GAUTAM thanks, CI run: https://ci.nodejs.org/job/node-test-pull-request/8508/

Will plan to land later today.

@mhdawson
Copy link
Member

mhdawson commented Jun 6, 2017

CI good. Failure was unrelated. Opened #13498 to track the failure. Going to land.

@mhdawson
Copy link
Member

mhdawson commented Jun 6, 2017

Thanks @200GAUTAM, landed as 3630ed1

@mhdawson mhdawson closed this Jun 6, 2017
mhdawson pushed a commit that referenced this pull request Jun 6, 2017
PR-URL: #13240
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
@200GAUTAM
Copy link
Contributor Author

@mhdawson Thanks for your help

jasnell pushed a commit that referenced this pull request Jun 7, 2017
PR-URL: #13240
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
@gibfahn gibfahn mentioned this pull request Jun 15, 2017
3 tasks
@MylesBorins
Copy link
Contributor

This does not land cleanly in LTS. Please feel free to manually backport. Please also feel free to replace do-not-land if it is being backported

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. tty Issues and PRs related to the tty subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants