| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 224dbb1 commit 7f3f72c
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -594,6 +594,12 @@ an argument of the wrong type has been passed to a Node.js API. | |||
| 594 | 594 | The `'ERR_INVALID_CALLBACK'` error code is used generically to identify that | |
| 595 | 595 | a callback function is required and has not been provided to a Node.js API. | |
| 596 | 596 | ||
| 597 | + <a id="ERR_INVALID_CURSOR_POS"></a> | ||
| 598 | + ### ERR_INVALID_CURSOR_POS | ||
| 599 | + | ||
| 600 | + The `'ERR_INVALID_CURSOR_POS'` is thrown specifically when a cursor on a given | ||
| 601 | + stream is attempted to move to a specified row without a specified column. | ||
| 602 | + | ||
| 597 | 603 | <a id="ERR_INVALID_FILE_URL_HOST"></a> | |
| 598 | 604 | ### ERR_INVALID_FILE_URL_HOST | |
| 599 | 605 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -124,6 +124,8 @@ E('ERR_INDEX_OUT_OF_RANGE', 'Index out of range'); | |||
| 124 | 124 | E('ERR_INVALID_ARG_TYPE', invalidArgType); | |
| 125 | 125 | E('ERR_INVALID_CALLBACK', 'callback must be a function'); | |
| 126 | 126 | E('ERR_INVALID_FD', (fd) => `"fd" must be a positive integer: ${fd}`); | |
| 127 | + E('ERR_INVALID_CURSOR_POS', | ||
| 128 | + 'Cannot set cursor row without setting its column'); | ||
| 127 | 129 | E('ERR_INVALID_FILE_URL_HOST', 'File URL host %s'); | |
| 128 | 130 | E('ERR_INVALID_FILE_URL_PATH', 'File URL path %s'); | |
| 129 | 131 | E('ERR_INVALID_HANDLE_TYPE', 'This handle type cannot be sent'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,6 +27,7 @@ | |||
| 27 | 27 | ||
| 28 | 28 | 'use strict'; | |
| 29 | 29 | ||
| 30 | + const errors = require('internal/errors'); | ||
| 30 | 31 | const { debug, inherits } = require('util'); | |
| 31 | 32 | const Buffer = require('buffer').Buffer; | |
| 32 | 33 | const EventEmitter = require('events'); | |
@@ -95,7 +96,7 @@ function Interface(input, output, completer, terminal) { | |||
| 95 | 96 | } | |
| 96 | 97 | ||
| 97 | 98 | if (completer && typeof completer !== 'function') { | |
| 98 | - throw new TypeError('Argument "completer" must be a function'); | ||
| 99 | + throw new errors.TypeError('ERR_INVALID_OPT_VALUE', 'completer', completer); | ||
| 99 | 100 | } | |
| 100 | 101 | ||
| 101 | 102 | if (historySize === undefined) { | |
@@ -105,7 +106,11 @@ function Interface(input, output, completer, terminal) { | |||
| 105 | 106 | if (typeof historySize !== 'number' || | |
| 106 | 107 | isNaN(historySize) || | |
| 107 | 108 | historySize < 0) { | |
| 108 | - throw new TypeError('Argument "historySize" must be a positive number'); | ||
| 109 | + throw new errors.RangeError( | ||
| 110 | + 'ERR_INVALID_OPT_VALUE', | ||
| 111 | + 'historySize', | ||
| 112 | + historySize | ||
| 113 | + ); | ||
| 109 | 114 | } | |
| 110 | 115 | ||
| 111 | 116 | // backwards compat; check the isTTY prop of the output stream | |
@@ -281,7 +286,12 @@ Interface.prototype._onLine = function(line) { | |||
| 281 | 286 | ||
| 282 | 287 | Interface.prototype._writeToOutput = function _writeToOutput(stringToWrite) { | |
| 283 | 288 | if (typeof stringToWrite !== 'string') | |
| 284 | - throw new TypeError('"stringToWrite" argument must be a string'); | ||
| 289 | + throw new errors.TypeError( | ||
| 290 | + 'ERR_INVALID_ARG_TYPE', | ||
| 291 | + 'stringToWrite', | ||
| 292 | + 'string', | ||
| 293 | + stringToWrite | ||
| 294 | + ); | ||
| 285 | 295 | ||
| 286 | 296 | if (this.output !== null && this.output !== undefined) | |
| 287 | 297 | this.output.write(stringToWrite); | |
@@ -1053,7 +1063,7 @@ function cursorTo(stream, x, y) { | |||
| 1053 | 1063 | return; | |
| 1054 | 1064 | ||
| 1055 | 1065 | if (typeof x !== 'number') | |
| 1056 | - throw new Error('Can\'t set cursor row without also setting it\'s column'); | ||
| 1066 | + throw new errors.Error('ERR_INVALID_CURSOR_POS'); | ||
| 1057 | 1067 | ||
| 1058 | 1068 | if (typeof y !== 'number') { | |
| 1059 | 1069 | stream.write(CSI`${x + 1}G`); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -77,7 +77,8 @@ assert.throws( | |||
| 77 | 77 | () => readline.cursorTo(writable, 'a', 1), | |
| 78 | 78 | common.expectsError({ | |
| 79 | 79 | type: Error, | |
| 80 | - message: /^Can't set cursor row without also setting it's column$/ | ||
| 80 | + code: 'ERR_INVALID_CURSOR_POS', | ||
| 81 | + message: 'Cannot set cursor row without setting its column' | ||
| 81 | 82 | })); | |
| 82 | 83 | assert.strictEqual(writable.data, ''); | |
| 83 | 84 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -315,14 +315,10 @@ function isWarned(emitter) { | |||
| 315 | 315 | input: fi, | |
| 316 | 316 | completer: 'string is not valid' | |
| 317 | 317 | }); | |
| 318 | - }, function(err) { | ||
| 319 | - if (err instanceof TypeError) { | ||
| 320 | - if (/Argument "completer" must be a function/.test(err)) { | ||
| 321 | - return true; | ||
| 322 | - } | ||
| 323 | - } | ||
| 324 | - return false; | ||
| 325 | - }); | ||
| 318 | + }, common.expectsError({ | ||
| 319 | + type: TypeError, | ||
| 320 | + code: 'ERR_INVALID_OPT_VALUE' | ||
| 321 | + })); | ||
| 326 | 322 | ||
| 327 | 323 | // duplicate lines are removed from history when | |
| 328 | 324 | // `options.removeHistoryDuplicates` is `true` | |
| Back | FazBrowse Home | New Git URL |
0 commit comments