From e203f76151530da3554859cc02471d322d87356b Mon Sep 17 00:00:00 2001
From: pwillis77
Date: Fri, 6 Sep 2024 12:17:39 +0000
Subject: [PATCH] feat: (NET-1537): improve error log
---
src/pages/errors/AppErrorPage.tsx | 3 ++-
src/utils/RouteUtils.ts | 7 +++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/pages/errors/AppErrorPage.tsx b/src/pages/errors/AppErrorPage.tsx
index 5c6b8bf0..29bafff5 100644
--- a/src/pages/errors/AppErrorPage.tsx
+++ b/src/pages/errors/AppErrorPage.tsx
@@ -10,6 +10,7 @@ interface AppErrorPageProps {
export function AppErrorPage(props: AppErrorPageProps) {
const navigate = useNavigate();
+ const currentPage = window.location.pathname;
return (
@@ -38,7 +39,7 @@ export function AppErrorPage(props: AppErrorPageProps) {
type="text"
size="large"
onClick={() => {
- fileBugReport(`${props.error}\n${JSON.stringify(props.info, null, 4)}`);
+ fileBugReport(`${props.error}\n${JSON.stringify(props.info, null, 4)}`, currentPage);
navigate(resolveAppRoute(AppRoutes.DASHBOARD_ROUTE));
}}
>
diff --git a/src/utils/RouteUtils.ts b/src/utils/RouteUtils.ts
index 0691c859..dd218234 100644
--- a/src/utils/RouteUtils.ts
+++ b/src/utils/RouteUtils.ts
@@ -235,9 +235,12 @@ export function openInNewTab(url: string) {
}
// Function to file a bug report for the UI
-export function fileBugReport(body: string) {
+export function fileBugReport(body: string, pageRoute: string) {
openInNewTab(
- BUG_REPORT_URL.replace(':body', `Describe what happened...%0A%0A Error log: %0A\`${encodeURIComponent(body)}\``),
+ BUG_REPORT_URL.replace(
+ ':body',
+ `Describe what happened...%0A%0APage route: ${pageRoute}%0A%0AError log: %0A\`${encodeURIComponent(body)}\``,
+ ),
);
}