mirror of
https://github.com/grpc/grpc-node.git
synced 2025-12-08 18:23:54 +00:00
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
6f5a955d8c
commit
2099f540d2
@ -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…
x
Reference in New Issue
Block a user