From 81e068ba9c17e0edb7ae86c15f570f0739b45400 Mon Sep 17 00:00:00 2001 From: catloversg <152669316+catloversg@users.noreply.github.com> Date: Tue, 5 Nov 2024 07:20:02 +0700 Subject: [PATCH] MISC: Include React component stack in Recovery Mode report (#1750) --- src/utils/ErrorHelper.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/utils/ErrorHelper.ts b/src/utils/ErrorHelper.ts index 2a838d5b7..884078d41 100644 --- a/src/utils/ErrorHelper.ts +++ b/src/utils/ErrorHelper.ts @@ -85,7 +85,7 @@ export function getErrorMetadata(error: unknown, errorInfo?: React.ErrorInfo, pa export function getErrorForDisplay(error: unknown, errorInfo?: React.ErrorInfo, page?: Page): IErrorData { const metadata = getErrorMetadata(error, errorInfo, page); - const fileName = (metadata.error as any).fileName; + const fileName = String(metadata.error.fileName); const features = `lang=${metadata.features.language} cookiesEnabled=${metadata.features.cookiesEnabled.toString()}` + ` doNotTrack=${metadata.features.doNotTrack ?? "null"} indexedDb=${metadata.features.indexedDb.toString()}`; @@ -104,7 +104,7 @@ Please fill this information with details if relevant. ### Environment -* Error: ${metadata.error.toString() ?? "n/a"} +* Error: ${String(metadata.error) ?? "n/a"} * Page: ${metadata.page ?? "n/a"} * Version: ${metadata.version.toDisplay()} * Environment: ${GameEnv[metadata.environment]} @@ -118,6 +118,11 @@ Please fill this information with details if relevant. ${metadata.error.stack} \`\`\` +### React Component Stack +\`\`\` +${metadata.errorInfo?.componentStack} +\`\`\` + ### Save \`\`\` Copy your save here if possible