aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-errors-systemerror.js
diff options
context:
space:
mode:
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
+ }
+ );
+}