import { StrictMode } from 'react'; import { createRoot } from 'react-dom/client'; import { Route, RouterProvider, createBrowserRouter, createRoutesFromElements, useRouteError } from 'react-router'; import App from 'App'; const errorPageStyles = { container: { display: 'flex', flexDirection: 'column' as const, alignItems: 'center', justifyContent: 'center', minHeight: '100vh', padding: '2rem', textAlign: 'center' as const, backgroundColor: '#1e1e1e', color: '#eee' }, logo: { width: '100px', height: '100px', marginBottom: '2rem' }, title: { fontSize: '2rem', margin: '0 0 1rem 0', color: '#90CAF9', fontWeight: 500 as const }, status: { color: '#2196f3', fontSize: '1.5rem', fontWeight: 400 as const, margin: '0 0 1rem 0' }, message: { fontFamily: 'monospace, monospace', fontSize: '1.1rem', color: '#9e9e9e', maxWidth: '600px', margin: '0 0 2rem 0' }, message2: { fontSize: '1.1rem', color: '#2196f3', maxWidth: '600px', margin: '0 0 2rem 0' } }; interface ErrorWithStatus { status?: number | string; statusText?: string; message?: string; } function isErrorWithDetails(error: unknown): error is ErrorWithStatus { return typeof error === 'object' && error !== null; } function getErrorStatus(error: unknown): string { if (isErrorWithDetails(error) && 'status' in error && error.status != null) { return String(error.status); } return 'Error'; } function getErrorMessage(error: unknown): string { if (!isErrorWithDetails(error)) { return 'Something went wrong'; } return error.statusText || error.message || 'Something went wrong'; } // Custom Error Component function ErrorPage() { const error = useRouteError(); return (
{getErrorStatus(error)}: {getErrorMessage(error)}
Please report on{' '} https://docs.emsesp.org/Support