summaryrefslogtreecommitdiff
path: root/cli/js/error_stack.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/js/error_stack.ts')
-rw-r--r--cli/js/error_stack.ts13
1 files changed, 7 insertions, 6 deletions
diff --git a/cli/js/error_stack.ts b/cli/js/error_stack.ts
index daf983ba1..39561ad85 100644
--- a/cli/js/error_stack.ts
+++ b/cli/js/error_stack.ts
@@ -214,7 +214,13 @@ function evaluateCallSite(callSite: CallSite): CallSiteEval {
};
}
-function prepareStackTrace(error: Error, callSites: CallSite[]): string {
+function prepareStackTrace(
+ error: Error & {
+ __callSiteEvals: CallSiteEval[];
+ __formattedFrames: string[];
+ },
+ callSites: CallSite[]
+): string {
const mappedCallSites = callSites.map(
(callSite): CallSite => {
const fileName = callSite.getFileName();
@@ -238,19 +244,14 @@ function prepareStackTrace(error: Error, callSites: CallSite[]): string {
__formattedFrames: { value: [], configurable: true },
});
for (const callSite of mappedCallSites) {
- // @ts-expect-error
error.__callSiteEvals.push(Object.freeze(evaluateCallSite(callSite)));
const isInternal = callSite.getFileName()?.startsWith("$deno$") ?? false;
- // @ts-expect-error
error.__formattedFrames.push(callSiteToString(callSite, isInternal));
}
- // @ts-expect-error
Object.freeze(error.__callSiteEvals);
- // @ts-expect-error
Object.freeze(error.__formattedFrames);
return (
`${error.name}: ${error.message}\n` +
- // @ts-expect-error
error.__formattedFrames
.map((s: string) => ` at ${colors.stripColor(s)}`)
.join("\n")