-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Since these are executing JS code, and in particular parts of that code may be provided by userland, handle such exceptions in C++. Refs: #17938 (comment) PR-URL: #18028 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
- Loading branch information
1 parent
07e8195
commit 5b8e46d
Showing
2 changed files
with
63 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Flags: --expose-internals | ||
'use strict'; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const JSStreamWrap = require('internal/wrap_js_stream'); | ||
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!'); | ||
}) | ||
})); | ||
|
||
assert.throws(() => socket.end('foo'), /Error: write EPROTO/); |