Improve error code

This commit is contained in:
Alexis Sellier
2021-05-04 20:02:58 +02:00
parent 836bd4cbea
commit fbce111e22
8 changed files with 128 additions and 97 deletions
+35
View File
@@ -0,0 +1,35 @@
<script lang="typescript">
import { createEventDispatcher } from 'svelte';
import Modal from '@app/Modal.svelte';
import type { Err } from '@app/error';
const dispatch = createEventDispatcher();
export let error: Err | null = null;
export let title = "Error";
export let subtitle: string = "";
export let message: string = "";
export let floating = false;
let body = message || (error && error.message) || "";
</script>
<Modal on:close error {floating}>
<span slot="title">
{title}
</span>
<span slot="subtitle">
{subtitle}
</span>
<span slot="body">
<strong>Error:</strong> {body}
</span>
<span slot="actions">
<button on:click={() => dispatch('close')}>
Back
</button>
</span>
</Modal>