Skip to content

Commit

Permalink
Undefined handling for results from stack-trace.get (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrHeinz authored Mar 8, 2024
1 parent fb2f778 commit 50fbffe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/edge/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function getStackContext(logtail: Edge): Context {
function getCallingFrame(logtail: Edge): StackFrame | null {
for (let fn of [logtail.warn, logtail.error, logtail.info, logtail.debug, logtail.log]) {
const stack = stackTrace.get(fn as any);
if (stack.length > 0) return getRelevantStackFrame(stack);
if (stack?.length > 0) return getRelevantStackFrame(stack);
}

return null;
Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function getStackContext(logtail: Node, stackContextHint?: StackContextHi
function getCallingFrame(logtail: Node, stackContextHint?: StackContextHint): StackFrame | null {
for (let fn of [logtail.warn, logtail.error, logtail.info, logtail.debug, logtail.log]) {
const stack = stackTrace.get(fn as any);
if (stack.length > 0) return getRelevantStackFrame(stack, stackContextHint);
if (stack?.length > 0) return getRelevantStackFrame(stack, stackContextHint);
}

return null;
Expand Down

0 comments on commit 50fbffe

Please sign in to comment.