diff --git a/apps/console2/src/components/PageError.tsx b/apps/console2/src/components/PageError.tsx index 14efa64be..893486e74 100644 --- a/apps/console2/src/components/PageError.tsx +++ b/apps/console2/src/components/PageError.tsx @@ -7,21 +7,27 @@ const classNames = { wrapper: "py-10 text-center space-y-2 ", title: "text-2xl flex gap-2 font-semibold items-center justify-center", description: "text-base text-txt-tertiary", + detail: + "text-sm text-txt-tertiary font-mono text-start border border-border-low p-2 rounded bg-level-1 mt-2", }; type Props = { - resetErrorBoundary: () => void; + resetErrorBoundary?: () => void; + error?: string; }; -export function PageError({ resetErrorBoundary }: Props) { - const error = useRouteError(); +export function PageError({ resetErrorBoundary, error: propsError }: Props) { + const error = useRouteError() ?? propsError; const { __ } = useTranslate(); const location = useLocation(); const baseLocation = useRef(location); // Reset error boundary on page change useEffect(() => { - if (location.pathname !== baseLocation.current.pathname) { + if ( + location.pathname !== baseLocation.current.pathname && + resetErrorBoundary + ) { resetErrorBoundary(); } }, [location, resetErrorBoundary]); @@ -43,7 +49,12 @@ export function PageError({ resetErrorBoundary }: Props) { return (

{__("Unexpected error :(")}

-

{error.toString()}

+
+ + {__("Something went wrong")} + +

{error.toString()}

+
); }