Skip to content

Commit 213230c

Browse files
davidfialamurgatroid99
authored andcommitted
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.
1 parent 729a3f5 commit 213230c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/grpc-js/src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export type ClientOptions = Partial<ChannelOptions> & {
110110
};
111111

112112
function getErrorStackString(error: Error): string {
113-
return error.stack!.split('\n').slice(1).join('\n');
113+
return error.stack?.split('\n').slice(1).join('\n') || 'no stack trace available';
114114
}
115115

116116
/**

0 commit comments

Comments
 (0)