Skip to content
Browse files

errors: add space between error name and code

`Error[CODE]` becomes `Error [CODE]`

PR-URL: #12099
Reviewed-By: Rich Trott <>
Reviewed-By: Gibson Fahnestock <>
Reviewed-By: Luigi Pinca <>
Reviewed-By: Anna Henningsen <>
Reviewed-By: Evan Lucas <>
  • Loading branch information...
jasnell committed Mar 28, 2017
1 parent 9b05393 commit 7b4a72d797cc57bc69aa6be22c34505a456f7b3a
Showing with 6 additions and 6 deletions.
  1. +1 −1 lib/internal/errors.js
  2. +5 −5 test/parallel/test-internal-errors.js
@@ -26,7 +26,7 @@ function makeNodeError(Base) {

get name() {
return `${}[${this[kCode]}]`;
return `${} [${this[kCode]}]`;

get code() {
@@ -15,27 +15,27 @@ const err4 = new errors.Error('TEST_ERROR_2', 'abc', 'xyz');
const err5 = new errors.Error('TEST_ERROR_1');

assert(err1 instanceof Error);
assert.strictEqual(, 'Error[TEST_ERROR_1]');
assert.strictEqual(, 'Error [TEST_ERROR_1]');
assert.strictEqual(err1.message, 'Error for testing purposes: test');
assert.strictEqual(err1.code, 'TEST_ERROR_1');

assert(err2 instanceof TypeError);
assert.strictEqual(, 'TypeError[TEST_ERROR_1]');
assert.strictEqual(, 'TypeError [TEST_ERROR_1]');
assert.strictEqual(err2.message, 'Error for testing purposes: test');
assert.strictEqual(err2.code, 'TEST_ERROR_1');

assert(err3 instanceof RangeError);
assert.strictEqual(, 'RangeError[TEST_ERROR_1]');
assert.strictEqual(, 'RangeError [TEST_ERROR_1]');
assert.strictEqual(err3.message, 'Error for testing purposes: test');
assert.strictEqual(err3.code, 'TEST_ERROR_1');

assert(err4 instanceof Error);
assert.strictEqual(, 'Error[TEST_ERROR_2]');
assert.strictEqual(, 'Error [TEST_ERROR_2]');
assert.strictEqual(err4.message, 'abc xyz');
assert.strictEqual(err4.code, 'TEST_ERROR_2');

assert(err5 instanceof Error);
assert.strictEqual(, 'Error[TEST_ERROR_1]');
assert.strictEqual(, 'Error [TEST_ERROR_1]');
assert.strictEqual(err5.message, 'Error for testing purposes: %s');
assert.strictEqual(err5.code, 'TEST_ERROR_1');

0 comments on commit 7b4a72d

Please sign in to comment.
You can’t perform that action at this time.