Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: (NET-1537): improve error log #750

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/pages/errors/AppErrorPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface AppErrorPageProps {

export function AppErrorPage(props: AppErrorPageProps) {
const navigate = useNavigate();
const currentPage = window.location.pathname;

return (
<Layout style={{ position: 'relative', minHeight: '100dvh', justifyContent: 'center', alignItems: 'center' }}>
Expand Down Expand Up @@ -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));
}}
>
Expand Down
7 changes: 5 additions & 2 deletions src/utils/RouteUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)}\``,
),
);
}

Expand Down
Loading