Skip to content

Commit

Permalink
fix(logger): Updates for stacktrace handling
Browse files Browse the repository at this point in the history
A few changes and fixes to the stacktrace handling

Semver: patch
  • Loading branch information
TerryMooreII committed Apr 24, 2024
1 parent 3aed488 commit 6a14611
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,19 @@ const processStackFrames = (stackframes: any) => {
};

const getStackTraceFromError = async (error: Error) => {
// This converts something like `throw 'some string'` into a real error
if (typeof error === 'string') error = new Error(error);
try {
const stackframes = await StackTrace.fromError(error);
return processStackFrames(stackframes);
} catch (error) {
return 'Error getting trace';
}
} catch (error) {}
};

const getStackTrace = async () => {
try {
const stackframes = await StackTrace.get();
return processStackFrames(stackframes);
} catch (error: any) {
return 'Error getting trace';
}
} catch (error: any) {}
};

const _randomBetween = (min: number, max: number) => {
Expand Down

0 comments on commit 6a14611

Please sign in to comment.