summaryrefslogtreecommitdiff
path: root/test/parallel/test-errors-systemerror.js
diff options
context:
space:
mode:
authorAmer Alimanović <x@amer8.com>2018-11-06 17:46:28 +0000
committerGireesh Punathil <gpunathi@in.ibm.com>2018-11-10 19:11:18 +0530
commit0f8d7a684f1a4885f14b5b5e1c5f675e2738712c (patch)
treecb517a530be814881fa9f7cb14e5a8b67a2a2127 /test/parallel/test-errors-systemerror.js
parentef907bb4d99d1b445a1c78f602112206a01ddbfe (diff)
downloadandroid-node-v8-0f8d7a684f1a4885f14b5b5e1c5f675e2738712c.tar.gz
android-node-v8-0f8d7a684f1a4885f14b5b5e1c5f675e2738712c.tar.bz2
android-node-v8-0f8d7a684f1a4885f14b5b5e1c5f675e2738712c.zip
test: add coverage for systemerror set name
PR-URL: https://github.com/nodejs/node/pull/24200 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'test/parallel/test-errors-systemerror.js')
-rw-r--r--test/parallel/test-errors-systemerror.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/parallel/test-errors-systemerror.js b/test/parallel/test-errors-systemerror.js
index 957a0dd7b2..0b5f9b9a10 100644
--- a/test/parallel/test-errors-systemerror.js
+++ b/test/parallel/test-errors-systemerror.js
@@ -111,3 +111,25 @@ const { ERR_TEST } = codes;
assert.strictEqual(err.path, 'path');
assert.strictEqual(err.dest, 'path');
}
+
+{
+ const ctx = {
+ code: 'ERR_TEST',
+ message: 'Error occurred',
+ syscall: 'syscall_test'
+ };
+ assert.throws(
+ () => {
+ const err = new ERR_TEST(ctx);
+ err.name = 'SystemError [CUSTOM_ERR_TEST]';
+ throw err;
+ },
+ {
+ code: 'ERR_TEST',
+ name: 'SystemError [CUSTOM_ERR_TEST]',
+ message: 'custom message: syscall_test returned ERR_TEST ' +
+ '(Error occurred)',
+ info: ctx
+ }
+ );
+}