summaryrefslogtreecommitdiff
path: root/lib/tty.js
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2018-02-27 14:55:32 +0100
committerMichaël Zasso <targos@protonmail.com>2018-03-05 19:51:30 +0100
commit1e8d110e640c658e4f6ed7540db62d063269ba6c (patch)
treeafe2636b1b190fee00006beaa484fa77d5949770 /lib/tty.js
parent023f49c5a938ef631260b76876155eaf957084be (diff)
downloadandroid-node-v8-1e8d110e640c658e4f6ed7540db62d063269ba6c.tar.gz
android-node-v8-1e8d110e640c658e4f6ed7540db62d063269ba6c.tar.bz2
android-node-v8-1e8d110e640c658e4f6ed7540db62d063269ba6c.zip
lib: port errors to new system
This is a first batch of updates that touches non-underscored modules in lib. PR-URL: https://github.com/nodejs/node/pull/19034 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'lib/tty.js')
-rw-r--r--lib/tty.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/tty.js b/lib/tty.js
index 79e61e981b..51ec1cf898 100644
--- a/lib/tty.js
+++ b/lib/tty.js
@@ -25,6 +25,7 @@ const { inherits, _extend } = require('util');
const net = require('net');
const { TTY, isTTY } = process.binding('tty_wrap');
const errors = require('internal/errors');
+const { ERR_INVALID_FD } = errors.codes;
const readline = require('readline');
const { release } = require('os');
@@ -43,7 +44,7 @@ function ReadStream(fd, options) {
if (!(this instanceof ReadStream))
return new ReadStream(fd, options);
if (fd >> 0 !== fd || fd < 0)
- throw new errors.RangeError('ERR_INVALID_FD', fd);
+ throw new ERR_INVALID_FD(fd);
const ctx = {};
const tty = new TTY(fd, true, ctx);
@@ -75,7 +76,7 @@ function WriteStream(fd) {
if (!(this instanceof WriteStream))
return new WriteStream(fd);
if (fd >> 0 !== fd || fd < 0)
- throw new errors.RangeError('ERR_INVALID_FD', fd);
+ throw new ERR_INVALID_FD(fd);
const ctx = {};
const tty = new TTY(fd, false, ctx);