Skip to content

Commit 7795014

Browse files
authored
Merge pull request #2210 from murgatroid99/grpc-js_status_decode_error_fix
grpc-js: Handle errors when decoding status details
2 parents df07da3 + a82e40f commit 7795014

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/grpc-js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@grpc/grpc-js",
3-
"version": "1.6.10",
3+
"version": "1.6.11",
44
"description": "gRPC Library for Node - pure JS implementation",
55
"homepage": "https://grpc.io/",
66
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",

packages/grpc-js/src/call-stream.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,11 @@ export class Http2CallStream implements Call {
488488
}
489489
let details = '';
490490
if (typeof metadataMap['grpc-message'] === 'string') {
491-
details = decodeURI(metadataMap['grpc-message']);
491+
try {
492+
details = decodeURI(metadataMap['grpc-message']);
493+
} catch (e) {
494+
details = metadataMap['grpc-messages'] as string;
495+
}
492496
metadata.remove('grpc-message');
493497
this.trace(
494498
'received status details string "' + details + '" from server'

0 commit comments

Comments
 (0)