From 1ea66d6f23b01f810e05f4a792933e6c37866053 Mon Sep 17 00:00:00 2001 From: Kevin Nadro Date: Thu, 8 May 2025 21:17:34 -0500 Subject: [PATCH] [Fix]: Always show stack trace on the page if an Error shows up (#6785) * fix: show stack traces * fix: update GH with report a bug --- src/components/ErrorPage.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/ErrorPage.tsx b/src/components/ErrorPage.tsx index 73467e226..e9f89e591 100644 --- a/src/components/ErrorPage.tsx +++ b/src/components/ErrorPage.tsx @@ -24,10 +24,18 @@ function errorMessage(error: unknown): string { } } +function stackTraceMessage(error: unknown): string { + if (error !== undefined && error instanceof Error) { + return error.stack || '' + } + return '' +} + /** Generate a GitHub issue URL from the error */ function generateToUrl(error: unknown) { const title: string = 'An unexpected error occurred' - const body = errorMessage(error) + const newLine = '%0A' + const body = `${errorMessage(error)} ${newLine} >${stackTraceMessage(error)} ${newLine}` const result = `https://github.com/KittyCAD/modeling-app/issues/new?title=${title}&body=${body}` return result } @@ -43,9 +51,12 @@ export const ErrorPage = () => {

An unexpected error occurred

-

+

<>{errorMessage(error)}

+

+ <>{stackTraceMessage(error)} +

{isDesktop() && (