blob: b162df03d6df48e2e77ca7ef5903463b972ad1f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
'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);
}));
|