We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8bbaab0 commit 087bae9Copy full SHA for 087bae9
doc/api/http2.md
@@ -1636,10 +1636,17 @@ server.on('stream', (stream) => {
1636
}
1637
1638
function onError(err) {
1639
- if (err.code === 'ENOENT') {
1640
- stream.respond({ ':status': 404 });
1641
- } else {
1642
- stream.respond({ ':status': 500 });
+ // stream.respond() can throw if the stream has been destroyed by
+ // the other side.
+ try {
+ if (err.code === 'ENOENT') {
1643
+ stream.respond({ ':status': 404 });
1644
+ } else {
1645
+ stream.respond({ ':status': 500 });
1646
+ }
1647
+ } catch (err) {
1648
+ // Perform actual error handling.
1649
+ console.log(err);
1650
1651
stream.end();
1652
0 commit comments