blob: eeab26f525ae5082b2e00a09226bbf3cba046292 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
// 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/);
|