11cb0ef41Sopenharmony_ci// Flags: --expose-internals 21cb0ef41Sopenharmony_ci'use strict'; 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciconst assert = require('assert'); 51cb0ef41Sopenharmony_ciconst JSStreamWrap = require('internal/js_stream_socket'); 61cb0ef41Sopenharmony_ciconst { Duplex } = require('stream'); 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciprocess.once('uncaughtException', common.mustCall((err) => { 91cb0ef41Sopenharmony_ci assert.strictEqual(err.message, 'exception!'); 101cb0ef41Sopenharmony_ci})); 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_ciconst socket = new JSStreamWrap(new Duplex({ 131cb0ef41Sopenharmony_ci read: common.mustCall(), 141cb0ef41Sopenharmony_ci write: common.mustCall(() => { 151cb0ef41Sopenharmony_ci throw new Error('exception!'); 161cb0ef41Sopenharmony_ci }) 171cb0ef41Sopenharmony_ci})); 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_cisocket.end('foo'); 201cb0ef41Sopenharmony_cisocket.on('error', common.expectsError({ 211cb0ef41Sopenharmony_ci name: 'Error', 221cb0ef41Sopenharmony_ci message: 'write EPROTO' 231cb0ef41Sopenharmony_ci})); 24