mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 07:27:49 +00:00

This reverts commit 3de5eae6db
.
PR-URL: https://github.com/nodejs/node/pull/29741
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
20 lines
561 B
JavaScript
20 lines
561 B
JavaScript
// Flags: --expose-internals
|
|
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const JSStreamWrap = require('internal/js_stream_socket');
|
|
const { Duplex } = require('stream');
|
|
|
|
process.once('uncaughtException', common.mustCall((err) => {
|
|
assert.strictEqual(err.message, 'exception!');
|
|
}));
|
|
|
|
const socket = new JSStreamWrap(new Duplex({
|
|
read: common.mustNotCall(),
|
|
write: common.mustCall((buffer, data, cb) => {
|
|
throw new Error('exception!');
|
|
})
|
|
}));
|
|
|
|
assert.throws(() => socket.end('foo'), /Error: write EPROTO/);
|