2018-01-07 22:07:13 +01:00
|
|
|
// Flags: --expose-internals
|
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
const assert = require('assert');
|
2018-12-19 14:14:57 -08:00
|
|
|
const JSStreamWrap = require('internal/js_stream_socket');
|
2018-01-07 22:07:13 +01:00
|
|
|
const { Duplex } = require('stream');
|
|
|
|
|
|
|
|
process.once('uncaughtException', common.mustCall((err) => {
|
|
|
|
assert.strictEqual(err.message, 'exception!');
|
|
|
|
}));
|
|
|
|
|
|
|
|
const socket = new JSStreamWrap(new Duplex({
|
2019-08-17 13:11:37 +02:00
|
|
|
read: common.mustCall(),
|
2023-03-19 15:47:44 -05:00
|
|
|
write: common.mustCall(() => {
|
2018-01-07 22:07:13 +01:00
|
|
|
throw new Error('exception!');
|
|
|
|
})
|
|
|
|
}));
|
|
|
|
|
2019-08-24 16:33:46 +02:00
|
|
|
socket.end('foo');
|
|
|
|
socket.on('error', common.expectsError({
|
2019-12-25 18:02:16 +01:00
|
|
|
name: 'Error',
|
2019-08-24 16:33:46 +02:00
|
|
|
message: 'write EPROTO'
|
|
|
|
}));
|