mirror of https://github.com/grpc/grpc-node.git
Resolve exception when Error.stackTraceLimit is undefined
Some applications may explicitly set Error.stackTraceLimit = undefined. In this case it is not safe to assume new Error().stack is available.
This commit is contained in:
parent
729a3f52cf
commit
213230c73b
|
@ -110,7 +110,7 @@ export type ClientOptions = Partial<ChannelOptions> & {
|
|||
};
|
||||
|
||||
function getErrorStackString(error: Error): string {
|
||||
return error.stack!.split('\n').slice(1).join('\n');
|
||||
return error.stack?.split('\n').slice(1).join('\n') || 'no stack trace available';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue