Skip to content

Commit 50fbffe

Browse files
authored
Undefined handling for results from stack-trace.get (#110)
1 parent fb2f778 commit 50fbffe

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/edge/src/context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function getStackContext(logtail: Edge): Context {
2929
function getCallingFrame(logtail: Edge): StackFrame | null {
3030
for (let fn of [logtail.warn, logtail.error, logtail.info, logtail.debug, logtail.log]) {
3131
const stack = stackTrace.get(fn as any);
32-
if (stack.length > 0) return getRelevantStackFrame(stack);
32+
if (stack?.length > 0) return getRelevantStackFrame(stack);
3333
}
3434

3535
return null;

packages/node/src/context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function getStackContext(logtail: Node, stackContextHint?: StackContextHi
3535
function getCallingFrame(logtail: Node, stackContextHint?: StackContextHint): StackFrame | null {
3636
for (let fn of [logtail.warn, logtail.error, logtail.info, logtail.debug, logtail.log]) {
3737
const stack = stackTrace.get(fn as any);
38-
if (stack.length > 0) return getRelevantStackFrame(stack, stackContextHint);
38+
if (stack?.length > 0) return getRelevantStackFrame(stack, stackContextHint);
3939
}
4040

4141
return null;

0 commit comments

Comments
 (0)