mirror of
https://github.com/nodejs/node.git
synced 2025-04-30 23:56:58 +00:00

PR-URL: https://github.com/nodejs/node/pull/27650 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
28 lines
678 B
JavaScript
28 lines
678 B
JavaScript
'use strict';
|
|
|
|
// This tests that the error emitted on the socket does
|
|
// not get fired again when the 'error' event handler throws
|
|
// an error.
|
|
|
|
const common = require('../common');
|
|
const { addresses } = require('../common/internet');
|
|
const { errorLookupMock } = require('../common/dns');
|
|
|
|
const assert = require('assert');
|
|
const http = require('http');
|
|
|
|
const host = addresses.INVALID_HOST;
|
|
|
|
const req = http.get({
|
|
host,
|
|
lookup: common.mustCall(errorLookupMock())
|
|
});
|
|
const err = new Error('mock unexpected code error');
|
|
req.on('error', common.mustCall(() => {
|
|
throw err;
|
|
}));
|
|
|
|
process.on('uncaughtException', common.mustCall((e) => {
|
|
assert.strictEqual(e, err);
|
|
}));
|