diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2018-02-03 17:09:15 +0800 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2018-02-07 18:42:40 +0800 |
commit | c0762c2f54f80b92f2f5e0f9af51f4c048c53e4f (patch) | |
tree | d6bcae1119e5cfdc03675b148cdca784686be10e /lib/tty.js | |
parent | 030384833f95ee9f61fc194cdcab4075df083926 (diff) | |
download | android-node-v8-c0762c2f54f80b92f2f5e0f9af51f4c048c53e4f.tar.gz android-node-v8-c0762c2f54f80b92f2f5e0f9af51f4c048c53e4f.tar.bz2 android-node-v8-c0762c2f54f80b92f2f5e0f9af51f4c048c53e4f.zip |
errors: move error creation helpers to errors.js
This commit moves error creation helpers scattered around
under lib/ into lib/internal/errors.js in the hope of being clearer
about the differences of errors that we throw into the user land.
- Move util._errnoException and util._exceptionWithHostPort
into internal/errors.js and simplify their logic so it's
clearer what the properties these helpers create.
- Move the errnoException helper in dns.js to internal/errors.js
into internal/errors.js and rename it to dnsException. Simplify
it's logic so it no longer calls errnoException and skips
the unnecessary argument checks.
PR-URL: https://github.com/nodejs/node/pull/18546
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/tty.js')
-rw-r--r-- | lib/tty.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/tty.js b/lib/tty.js index 584ff9d870..79e61e981b 100644 --- a/lib/tty.js +++ b/lib/tty.js @@ -21,7 +21,7 @@ 'use strict'; -const { inherits, _errnoException, _extend } = require('util'); +const { inherits, _extend } = require('util'); const net = require('net'); const { TTY, isTTY } = process.binding('tty_wrap'); const errors = require('internal/errors'); @@ -178,7 +178,7 @@ WriteStream.prototype._refreshSize = function() { const winSize = new Array(2); const err = this._handle.getWindowSize(winSize); if (err) { - this.emit('error', _errnoException(err, 'getWindowSize')); + this.emit('error', errors.errnoException(err, 'getWindowSize')); return; } const [newCols, newRows] = winSize; |