blob: 1b4d469a758d77709acd7db56fddb8627666dc71 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
// 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.mustCall(),
write: common.mustCall((buffer, data, cb) => {
throw new Error('exception!');
})
}));
socket.end('foo');
socket.on('error', common.expectsError({
name: 'Error',
message: 'write EPROTO'
}));
|