Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
internal/errors: remove obsolete lazy assert
The lazy assert should already be in place when calling any
of the E functions.
  • Loading branch information
BridgeAR committed Jul 11, 2017
commit 59559cab40941d7b012716a5ada9363d6eb7cf8a
8 changes: 1 addition & 7 deletions lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ E('ERR_INDEX_OUT_OF_RANGE', 'Index out of range');
E('ERR_INVALID_ARG_TYPE', invalidArgType);
E('ERR_INVALID_ARRAY_LENGTH',
(name, length, actual) => {
const assert = lazyAssert();
assert.strictEqual(typeof actual, 'number');
return `The "${name}" array must have a length of ${
length}. Received length ${actual}`;
Expand All @@ -148,10 +147,7 @@ E('ERR_INVALID_THIS', 'Value of "this" must be of type %s');
E('ERR_INVALID_TUPLE', '%s must be an iterable %s tuple');
E('ERR_INVALID_URL', 'Invalid URL: %s');
E('ERR_INVALID_URL_SCHEME',
(expected) => {
lazyAssert();
return `The URL must be ${oneOf(expected, 'scheme')}`;
});
(expected) => `The URL must be ${oneOf(expected, 'scheme')}`);
E('ERR_IPC_CHANNEL_CLOSED', 'Channel closed');
E('ERR_IPC_DISCONNECTED', 'IPC channel is already disconnected');
E('ERR_IPC_ONE_PIPE', 'Child process can have only one IPC pipe');
Expand Down Expand Up @@ -181,7 +177,6 @@ E('ERR_V8BREAKITERATOR', 'Full ICU data not installed. ' +
// Add new errors from here...

function invalidArgType(name, expected, actual) {
const assert = lazyAssert();
assert(name, 'name is required');
const type = name.includes('.') ? 'property' : 'argument';
var msg = `The "${name}" ${type} must be ${oneOf(expected, 'type')}`;
Expand All @@ -192,7 +187,6 @@ function invalidArgType(name, expected, actual) {
}

function missingArgs(...args) {
const assert = lazyAssert();
assert(args.length > 0, 'At least one arg needs to be specified');
let msg = 'The ';
const len = args.length;
Expand Down