From 7b4a72d797cc57bc69aa6be22c34505a456f7b3a Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 28 Mar 2017 12:40:24 -0700 Subject: [PATCH] errors: add space between error name and code `Error[CODE]` becomes `Error [CODE]` PR-URL: https://github.com/nodejs/node/pull/12099 Reviewed-By: Rich Trott Reviewed-By: Gibson Fahnestock Reviewed-By: Luigi Pinca Reviewed-By: Anna Henningsen Reviewed-By: Evan Lucas --- lib/internal/errors.js | 2 +- test/parallel/test-internal-errors.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) 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');