-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
lib: migrate errors to internal/errors #17719
Changes from all commits
2fb022e
983f368
68a73c1
c28d36c
a76b9f1
d01a120
271e9b6
b101fca
67848eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2379,8 +2379,13 @@ WriteStream.prototype.open = function() { | |
|
||
|
||
WriteStream.prototype._write = function(data, encoding, cb) { | ||
if (!(data instanceof Buffer)) | ||
return this.emit('error', new Error('Invalid data')); | ||
if (!(data instanceof Buffer)) { | ||
const err = new errors.TypeError('ERR_INVALID_ARG_TYPE', | ||
'data', | ||
'Buffer', | ||
data); | ||
return this.emit('error', err); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. while we are at it, I would see if we can convert this to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @mcollina, this is my first time looking at the source code for Node so I'm not sure what the implications are of changing that line 🙃
Thanks! 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
if (typeof this.fd !== 'number') { | ||
return this.once('open', function() { | ||
|
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.
Should likely update this to use
Buffer.isType()
but let's check with @mcollina firstThere 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.
I would keep this as it is, with
instanceof
.Buffer.isBuffer
is mainly needed outside of core.