From 31461543f40854fe575c05abbbce7e903b1534e4 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. --- 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 8505ec39b68642..a8e28fb17ec2f7 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -874,10 +874,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' });