We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents a6f3df7 + 052af31 commit 76d03e7Copy full SHA for 76d03e7
packages/grpc-js/src/call-stream.ts
@@ -839,7 +839,16 @@ export class Http2CallStream implements Call {
839
message,
840
flags: context.flags,
841
};
842
- const cb: WriteCallback = context.callback ?? (() => {});
+ const cb: WriteCallback = (error?: Error | null) => {
843
+ let code: Status = Status.UNAVAILABLE;
844
+ if ((error as NodeJS.ErrnoException)?.code === 'ERR_STREAM_WRITE_AFTER_END') {
845
+ code = Status.INTERNAL;
846
+ }
847
+ if (error) {
848
+ this.cancelWithStatus(code, `Write error: ${error.message}`);
849
850
+ context.callback?.();
851
+ };
852
this.isWriteFilterPending = true;
853
this.filterStack.sendMessage(Promise.resolve(writeObj)).then((message) => {
854
this.isWriteFilterPending = false;
0 commit comments