Skip to content

Commit

Permalink
feat: simple error boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Ionov committed Dec 26, 2023
1 parent a4fcea7 commit 91fd567
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
5 changes: 5 additions & 0 deletions src/components/Error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const Error = (props: { err: Record<'message', string> }) => {
return <div>{props.err.message}</div>;
};

export { Error };
22 changes: 13 additions & 9 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
/* @refresh reload */
import { render } from "solid-js/web";
import "solid-contextmenu/dist/style.css";
import { render } from 'solid-js/web';
import 'solid-contextmenu/dist/style.css';
import { ErrorBoundary } from 'solid-js';

import "./index.css";
import App from "./App";
import { StoreProvider } from "services/Context";
import './index.css';
import App from './App';
import { StoreProvider } from 'services/Context';
import { Error } from 'components/Error';

render(
() => (
<StoreProvider>
<App />
</StoreProvider>
<ErrorBoundary fallback={(err) => <Error err={err} />}>
<StoreProvider>
<App />
</StoreProvider>
</ErrorBoundary>
),
document.getElementById("root") as HTMLElement
document.getElementById('root') as HTMLElement
);

0 comments on commit 91fd567

Please sign in to comment.