grpc-js: Add detail to invalid metadata error

This commit is contained in:
murgatroid99 2019-11-07 17:22:03 -08:00
parent 1d157dfd10
commit 989288c1f0
1 changed files with 4 additions and 2 deletions

View File

@ -16,6 +16,8 @@
*/ */
import * as http2 from 'http2'; import * as http2 from 'http2';
import { log } from './logging';
import { LogVerbosity } from './constants';
const LEGAL_KEY_REGEX = /^[0-9a-z_.-]+$/; const LEGAL_KEY_REGEX = /^[0-9a-z_.-]+$/;
const LEGAL_NON_BINARY_VALUE_REGEX = /^[ -~]*$/; const LEGAL_NON_BINARY_VALUE_REGEX = /^[ -~]*$/;
@ -272,8 +274,8 @@ export class Metadata {
} }
} }
} catch (error) { } catch (error) {
error.message = `Failed to add metadata entry ${key}: ${values}. ${error.message}`; const message = `Failed to add metadata entry ${key}: ${values}. ${error.message}. For more information see https://github.com/grpc/grpc-node/issues/1173`;
process.emitWarning(error); log(LogVerbosity.ERROR, message);
} }
}); });
return result; return result;