-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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, console: migrate to use internal/errors.js #11308
Changes from all commits
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 |
---|---|---|
@@ -1,18 +1,19 @@ | ||
'use strict'; | ||
|
||
const util = require('util'); | ||
const errors = require('internal/errors'); | ||
|
||
function Console(stdout, stderr) { | ||
if (!(this instanceof Console)) { | ||
return new Console(stdout, stderr); | ||
} | ||
if (!stdout || typeof stdout.write !== 'function') { | ||
throw new TypeError('Console expects a writable stream instance'); | ||
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'stdout', 'WriteStream'); | ||
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. Hmm, wait, 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. Oh right, there are |
||
} | ||
if (!stderr) { | ||
stderr = stdout; | ||
} else if (typeof stderr.write !== 'function') { | ||
throw new TypeError('Console expects writable stream instances'); | ||
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'stderr', 'WriteStream'); | ||
} | ||
|
||
var prop = { | ||
|
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.
I think it will be
_
not-
. You can confirm this by building the docs locally, withmake docopen
.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.
I just checked and
#nodejs-error-codes
works.