diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 01e4e482cb0e69..aa3bb0de1df7c6 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -26,7 +26,7 @@ function makeNodeError(Base) { } get name() { - return `${super.name}[${this[kCode]}]`; + return `${super.name} [${this[kCode]}]`; } get code() { diff --git a/test/parallel/test-internal-errors.js b/test/parallel/test-internal-errors.js index 27cec48b5b01a0..b43d825e6cc995 100644 --- a/test/parallel/test-internal-errors.js +++ b/test/parallel/test-internal-errors.js @@ -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(err1.name, 'Error[TEST_ERROR_1]'); +assert.strictEqual(err1.name, '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(err2.name, 'TypeError[TEST_ERROR_1]'); +assert.strictEqual(err2.name, '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(err3.name, 'RangeError[TEST_ERROR_1]'); +assert.strictEqual(err3.name, '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(err4.name, 'Error[TEST_ERROR_2]'); +assert.strictEqual(err4.name, 'Error [TEST_ERROR_2]'); assert.strictEqual(err4.message, 'abc xyz'); assert.strictEqual(err4.code, 'TEST_ERROR_2'); assert(err5 instanceof Error); -assert.strictEqual(err5.name, 'Error[TEST_ERROR_1]'); +assert.strictEqual(err5.name, 'Error [TEST_ERROR_1]'); assert.strictEqual(err5.message, 'Error for testing purposes: %s'); assert.strictEqual(err5.code, 'TEST_ERROR_1');