We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 47626c5 commit f197012Copy full SHA for f197012
doc/api/http2.md
@@ -1669,10 +1669,17 @@ server.on('stream', (stream) => {
1669
}
1670
1671
function onError(err) {
1672
- if (err.code === 'ENOENT') {
1673
- stream.respond({ ':status': 404 });
1674
- } else {
1675
- stream.respond({ ':status': 500 });
+ // stream.respond() can throw if the stream has been destroyed by
+ // the other side.
+ try {
+ if (err.code === 'ENOENT') {
1676
+ stream.respond({ ':status': 404 });
1677
+ } else {
1678
+ stream.respond({ ':status': 500 });
1679
+ }
1680
+ } catch (err) {
1681
+ // Perform actual error handling.
1682
+ console.log(err);
1683
1684
stream.end();
1685
0 commit comments