mirror of
https://github.com/nodejs/node.git
synced 2025-05-08 09:07:45 +00:00

PR-URL: https://github.com/nodejs/node/pull/29491 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.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/);
|