Skip to content

Commit

Permalink
Merge pull request #1284 from murgatroid99/grpc-js_server_stream_error
Browse files Browse the repository at this point in the history
grpc-js: server calls: Don't try to send an error on stream error
  • Loading branch information
murgatroid99 committed Mar 5, 2020
2 parents 69482b2 + 8f668c8 commit c3fc579
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/grpc-js/src/server-call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,11 @@ export class Http2ServerCallStream<
super();

this.stream.once('error', (err: ServerErrorResponse) => {
err.code = Status.INTERNAL;
this.sendError(err);
/* We need an error handler to avoid uncaught error event exceptions, but
* there is nothing we can reasonably do here. Any error event should
* have a corresponding close event, which handles emitting the cancelled
* event. And the stream is now in a bad state, so we can't reasonably
* expect to be able to send an error over it. */
});

this.stream.once('close', () => {
Expand Down

0 comments on commit c3fc579

Please sign in to comment.