Skip to content

Commit

Permalink
test: verify isNativeError accepts internal errors
Browse files Browse the repository at this point in the history
This commit verifies that Node's internal errors are recognized
by V8's IsNativeError(), which is exposed in Node as
process.binding('util').isNativeError().

PR-URL: #13965
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Timothy Gu <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
  • Loading branch information
cjihrig committed Jun 30, 2017
1 parent a84c3be commit 4c8b244
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/parallel/test-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';
// Flags: --expose-internals
const common = require('../common');
const assert = require('assert');
const util = require('util');
const errors = require('internal/errors');
const binding = process.binding('util');
const context = require('vm').runInNewContext;

Expand Down Expand Up @@ -167,4 +169,8 @@ util.error('test');
assert.strictEqual(binding.isNativeError([]), false);
assert.strictEqual(binding.isNativeError(Object.create(Error.prototype)),
false);
assert.strictEqual(
binding.isNativeError(new errors.Error('ERR_IPC_CHANNEL_CLOSED')),
true
);
}

0 comments on commit 4c8b244

Please sign in to comment.