1'use strict'; 2 3// This tests that the error emitted on the socket does 4// not get fired again when the 'error' event handler throws 5// an error. 6 7const common = require('../common'); 8const { addresses } = require('../common/internet'); 9const { errorLookupMock } = require('../common/dns'); 10 11const assert = require('assert'); 12const http = require('http'); 13 14const host = addresses.INVALID_HOST; 15 16const req = http.get({ 17 host, 18 lookup: common.mustCall(errorLookupMock()) 19}); 20const err = new Error('mock unexpected code error'); 21req.on('error', common.mustCall(() => { 22 throw err; 23})); 24 25process.on('uncaughtException', common.mustCall((e) => { 26 assert.strictEqual(e, err); 27})); 28