Skip to content

Commit

Permalink
grpc-js: Look for ECONNRESET errors by parsing error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
murgatroid99 committed May 6, 2021
1 parent d82b1a3 commit e8efa33
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/grpc-js/package.json
@@ -1,6 +1,6 @@
{
"name": "@grpc/grpc-js",
"version": "1.3.0",
"version": "1.3.1",
"description": "gRPC Library for Node - pure JS implementation",
"homepage": "https://grpc.io/",
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",
Expand Down
7 changes: 6 additions & 1 deletion packages/grpc-js/src/call-stream.ts
Expand Up @@ -589,7 +589,12 @@ export class Http2CallStream implements Call {
* "Internal server error" message. */
details = `Received RST_STREAM with code ${stream.rstCode} (Internal server error)`;
} else {
if (this.internalError.errno === os.constants.errno.ECONNRESET) {
/* Parsing the error message is fragile, because it's not part
* of the contract, but it's the only usable information we
* know for sure is available at this point. The failure case
* a user seeing the error message, and a different error code.
*/
if (this.internalError.message.includes('ECONNRESET')) {
code = Status.UNAVAILABLE;
details = this.internalError.message;
} else {
Expand Down

0 comments on commit e8efa33

Please sign in to comment.