mirror of
https://github.com/nodejs/node.git
synced 2025-05-10 14:09:34 +00:00

req.socket._hadError should be set before emitting the error event. PR-URL: https://github.com/nodejs/node/pull/14659 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
17 lines
401 B
JavaScript
17 lines
401 B
JavaScript
'use strict';
|
|
const assert = require('assert');
|
|
const http = require('http');
|
|
const common = require('../common');
|
|
|
|
// not exists host
|
|
const host = '*'.repeat(256);
|
|
const req = http.get({ host });
|
|
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);
|
|
}));
|