Skip to content

Commit

Permalink
test: add coverage for systemerror set name
Browse files Browse the repository at this point in the history
PR-URL: #24200
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
  • Loading branch information
amer8 authored and BridgeAR committed Nov 13, 2018
1 parent bc97b62 commit b16e485
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/parallel/test-errors-systemerror.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
);
}

0 comments on commit b16e485

Please sign in to comment.