From 5135e24133f954aaa2ccd9f67705122555364516 Mon Sep 17 00:00:00 2001 From: davidmarkclements Date: Thu, 12 Apr 2018 02:08:03 +0200 Subject: [PATCH] errors: alter ERR_INVALID_CURSOR_POS Changes the base instance for ERR_INVALID_CURSOR_POS from Error to TypeError as a more accurate representation of the error. PR-URL: https://github.com/nodejs/node/pull/19960 Reviewed-By: James M Snell Reviewed-By: Trivikram Kamat Reviewed-By: Khaidi Chu Reviewed-By: Ruben Bridgewater Reviewed-By: Luigi Pinca Reviewed-By: Matteo Collina --- lib/internal/errors.js | 4 +--- test/parallel/test-readline-csi.js | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/internal/errors.js b/lib/internal/errors.js index d2205a4c71b3da..a91f5f6dcfd040 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -879,10 +879,8 @@ E('ERR_INVALID_BUFFER_SIZE', 'Buffer size must be a multiple of %s', RangeError); E('ERR_INVALID_CALLBACK', 'Callback must be a function', TypeError); E('ERR_INVALID_CHAR', invalidChar, TypeError); - -// This should probably be a `TypeError`. E('ERR_INVALID_CURSOR_POS', - 'Cannot set cursor row without setting its column', Error); + 'Cannot set cursor row without setting its column', TypeError); E('ERR_INVALID_DOMAIN_NAME', 'Unable to determine the domain name', TypeError); E('ERR_INVALID_FD', '"fd" must be a positive integer: %s', RangeError); diff --git a/test/parallel/test-readline-csi.js b/test/parallel/test-readline-csi.js index f5c2d3044c5cdf..25d5a5eb6e79d7 100644 --- a/test/parallel/test-readline-csi.js +++ b/test/parallel/test-readline-csi.js @@ -77,7 +77,7 @@ writable.data = ''; common.expectsError( () => readline.cursorTo(writable, 'a', 1), { - type: Error, + type: TypeError, code: 'ERR_INVALID_CURSOR_POS', message: 'Cannot set cursor row without setting its column' });