grpc-js: Handle errors when decoding status details

This commit is contained in:
Michael Lumish 2022-08-29 09:52:13 -07:00
parent df07da3a02
commit a82e40ff9a
2 changed files with 6 additions and 2 deletions

View File

@ -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",

View File

@ -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'