Skip to content

Commit

Permalink
Merge pull request #2210 from murgatroid99/grpc-js_status_decode_erro…
Browse files Browse the repository at this point in the history
…r_fix

grpc-js: Handle errors when decoding status details
  • Loading branch information
murgatroid99 committed Aug 29, 2022
2 parents df07da3 + a82e40f commit 7795014
Show file tree
Hide file tree
Showing 2 changed files with 6 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.6.10",
"version": "1.6.11",
"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
6 changes: 5 additions & 1 deletion packages/grpc-js/src/call-stream.ts
Expand Up @@ -488,7 +488,11 @@ export class Http2CallStream implements Call {
}
let details = '';
if (typeof metadataMap['grpc-message'] === 'string') {
details = decodeURI(metadataMap['grpc-message']);
try {
details = decodeURI(metadataMap['grpc-message']);
} catch (e) {
details = metadataMap['grpc-messages'] as string;
}
metadata.remove('grpc-message');
this.trace(
'received status details string "' + details + '" from server'
Expand Down

0 comments on commit 7795014

Please sign in to comment.