more fancy pancy error component

This commit is contained in:
Chris Kruining 2024-11-12 16:09:24 +01:00
parent da016f2e03
commit 597c7e4e0b
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
3 changed files with 35 additions and 8 deletions

View file

@ -64,7 +64,7 @@ export default function Editor(props: ParentProps) {
</nav>
<section>
<ErrorBoundary fallback={err => <ErrorComp error={err.message} />}>
<ErrorBoundary fallback={err => <ErrorComp error={err} />}>
<FilesProvider>
{props.children}
</FilesProvider>
@ -76,6 +76,14 @@ export default function Editor(props: ParentProps) {
</MenuProvider>
}
const ErrorComp: Component<{ error: string }> = (props) => {
return <div class={css.error}>{props.error}</div>
const ErrorComp: Component<{ error: Error }> = (props) => {
return <div class={css.error}>
<b>{props.error.message}</b>
<Show when={props.error.cause}>{
cause => <>{cause().description}</>
}</Show>
<a href="/">Return to start</a>
</div>;
};