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 <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
amer8 authored and MylesBorins committed Dec 26, 2018
1 parent 9fa7146 commit cd2dedf
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 cd2dedf

Please sign in to comment.