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,_stream_wrap: change _stream_wrap.js to use internal/errors.js #13291

Closed
wants to merge 1 commit into from
Closed

errors,_stream_wrap: change _stream_wrap.js to use internal/errors.js #13291

wants to merge 1 commit into from

Conversation

LakshmiSwethaG
Copy link
Contributor

Refs: #11273

@jasnell, pinging you for mentoring as this is my first PR to this project, thank you!

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

_stream_wrap.js

@nodejs-github-bot nodejs-github-bot added the stream Issues and PRs related to the stream subsystem. label May 30, 2017
@@ -49,7 +50,8 @@ function StreamWrap(stream) {
this.pause();
this.removeListener('data', ondata);

self.emit('error', new Error('Stream has StringDecoder'));
self.emit('error', new errors.Error('ERR_ASSERTION',
Copy link
Member

Choose a reason for hiding this comment

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

ERR_ASSERTION is the wrong code to use here. That should only be used with the assert module. I recommend creating a new code specific to this condition... perhaps ERR_STREAM_HAS_STRINGDECODER

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 , I followed your suggestions and made those changes.
In this process, I made few mistakes but I guess I recovered everything, please have a look.
Thanks.

@@ -49,7 +50,8 @@ function StreamWrap(stream) {
this.pause();
this.removeListener('data', ondata);

self.emit('error', new Error('Stream has StringDecoder'));
self.emit('error', new errors.Error('ERR_STREAM_HAS_STRINGDECODER',
'Stream has StringDecoder'));
Copy link
Member

Choose a reason for hiding this comment

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

Just move the message to the internal/errors.js file where the code is declared, then simplify this to just:

self.emit('error', new errors.Error('ERR_STREAM_HAS_STRINGDECODER'));

@mhdawson
Copy link
Member

mhdawson commented Jun 6, 2017

Unfortunately this needs a rebase.

@LakshmiSwethaG
Copy link
Contributor Author

Done the rebase and resolved the conflicts. Please review it. Thanks

@mhdawson
Copy link
Member

@tniessen tniessen self-assigned this Jun 17, 2017
@tniessen tniessen added the errors Issues and PRs related to JavaScript errors originated in Node.js core. label Jun 17, 2017
tniessen pushed a commit that referenced this pull request Jun 20, 2017
PR-URL: #13291
Refs: #11273
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@tniessen
Copy link
Member

Landed in d291338, thank you for your contribution! 🎉

@tniessen tniessen closed this Jun 20, 2017
@addaleax addaleax added the semver-major PRs that contain breaking changes and should be released in the next major version. label Jun 20, 2017
@addaleax
Copy link
Member

Labelled this semver-major as I think it should have been (not that there’s anything wrong with the patch), if I’m wrong feel free to remove the label.

@tniessen
Copy link
Member

@addaleax The error message did not change, why would this be semver-major?

@addaleax
Copy link
Member

@tniessen The error message changed from Error: Stream has StringDecoder to Error [ERR_STREAM_HAS_STRINGDECODER]: Stream has StringDecoder

@tniessen
Copy link
Member

@addaleax Right, my bad.

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. semver-major PRs that contain breaking changes and should be released in the next major version. stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants