mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
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>
This commit is contained in:
1 parent
9fa71468f5
commit
cd2dedfa4f
1 file changed
+22
@@ -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
|
||||
}
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user