From 6a14611403c3e63c7dd2db4c15ef045154238196 Mon Sep 17 00:00:00 2001 From: Terry Moore Date: Wed, 24 Apr 2024 11:30:09 -0400 Subject: [PATCH] fix(logger): Updates for stacktrace handling A few changes and fixes to the stacktrace handling Semver: patch --- src/utils.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index 08cc4ce..b209537 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -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) => {