mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
console: port errors to new system
This ports the errors to the new error system. Backport-PR-URL: https://github.com/nodejs/node/pull/19244 PR-URL: https://github.com/nodejs/node/pull/18857 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
1 parent
ffa16aad60
commit
07845fc19e
1 file changed
+3
-3
+3
-3
@@ -21,7 +21,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const errors = require('internal/errors');
|
||||
const { ERR_CONSOLE_WRITABLE_STREAM } = require('internal/errors').codes;
|
||||
const util = require('util');
|
||||
const kCounts = Symbol('counts');
|
||||
|
||||
@@ -35,12 +35,12 @@ function Console(stdout, stderr, ignoreErrors = true) {
|
||||
return new Console(stdout, stderr, ignoreErrors);
|
||||
}
|
||||
if (!stdout || typeof stdout.write !== 'function') {
|
||||
throw new errors.TypeError('ERR_CONSOLE_WRITABLE_STREAM', 'stdout');
|
||||
throw new ERR_CONSOLE_WRITABLE_STREAM('stdout');
|
||||
}
|
||||
if (!stderr) {
|
||||
stderr = stdout;
|
||||
} else if (typeof stderr.write !== 'function') {
|
||||
throw new errors.TypeError('ERR_CONSOLE_WRITABLE_STREAM', 'stderr');
|
||||
throw new ERR_CONSOLE_WRITABLE_STREAM('stderr');
|
||||
}
|
||||
|
||||
var prop = {
|
||||
|
||||
Reference in new issue
Block a user