From 70f9294e15d73f8f221116cee032db859a183112 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Tue, 5 Apr 2022 06:36:19 -0700 Subject: [PATCH] [bun:error] Fix exception --- packages/bun-error/index.tsx | 1 + packages/bun-error/sourcemap.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/bun-error/index.tsx b/packages/bun-error/index.tsx index a627a7a8d3..5211af8ea9 100644 --- a/packages/bun-error/index.tsx +++ b/packages/bun-error/index.tsx @@ -1390,6 +1390,7 @@ export function renderRuntimeError(error: Error) { remapped[1]; }, console.error); } else { + if (!mappings) return null; var frame = exception.stack.frames[frameIndex]; const { line, column_start } = frame.position; const remapped = remapPosition(mappings, line, column_start); diff --git a/packages/bun-error/sourcemap.ts b/packages/bun-error/sourcemap.ts index 23bd4cf8a8..bee83f559c 100644 --- a/packages/bun-error/sourcemap.ts +++ b/packages/bun-error/sourcemap.ts @@ -281,7 +281,7 @@ export function fetchAllMappings(files, signal) { for (const [file, indices] of [...map.entries()]) { const mapped = fetchMappings(file, signal); - if (mapped.then) { + if (mapped?.then) { var resolvers = []; for (let i = 0; i < indices.length; i++) { results[indices[i]] = new Promise((resolve, reject) => {