-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Conversation
lib/_stream_wrap.js
Outdated
@@ -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', |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
lib/_stream_wrap.js
Outdated
@@ -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')); |
There was a problem hiding this comment.
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'));
Unfortunately this needs a rebase. |
Done the rebase and resolved the conflicts. Please review it. Thanks |
Landed in d291338, thank you for your contribution! 🎉 |
Labelled this |
@addaleax The error message did not change, why would this be semver-major? |
@tniessen The error message changed from |
@addaleax Right, my bad. |
Refs: #11273
@jasnell, pinging you for mentoring as this is my first PR to this project, thank you!
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
_stream_wrap.js