Skip to content

Commit

Permalink
Wrap error messages in a separate component
Browse files Browse the repository at this point in the history
  • Loading branch information
dokempf committed Jul 18, 2024
1 parent e887ca0 commit d2fffee
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/FieldDispatch.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import OnelineL10nTextField from "./OnelineL10nTextField.svelte";
import OnelineTextField from "./OnelineTextField.svelte";
import TextField from "./TextField.svelte";
import NotImplemented from "./NotImplemented.svelte";
export let field;
export let data;
Expand Down Expand Up @@ -47,7 +48,7 @@
{:else if fieldtype === "text_oneline" }
<OnelineTextField data={data} field={field} table={table}/>
{:else}
Field Type {fieldtype} not yet implemented.
<NotImplemented message="Field Type {fieldtype} not yet implemented." />
{/if}
</P>
{/if}
Expand Down
13 changes: 13 additions & 0 deletions src/components/NotImplemented.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<script>
import { P } from "flowbite-svelte";
export let message;
console.warn(message);
</script>

<div class="easydb-not-implemented">
<P class="bg-red-100">
{message}
</P>
</div>
3 changes: 2 additions & 1 deletion src/components/RecursiveEasyDBDetailView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import Tabs from "./Tabs.svelte";
import TabItem from "./TabItem.svelte";
import FieldLabel from "./FieldLabel.svelte";
import NotImplemented from "./NotImplemented.svelte";
export let fields;
export let data;
Expand Down Expand Up @@ -127,7 +128,7 @@
<Link field={firstField} data={data} table={table}/>
<svelte:self fields={fields.slice(1)} data={data} table={table} label={label}/>
{:else}
<p>Mask element of kind {firstField.kind} not yet implemented.</p>
<NotImplemented message="Mask element of kind {firstField.kind} not yet implemented" />
<svelte:self fields={fields.slice(1)} data={data} table={table} label={label}/>
{/if}
{/if}

0 comments on commit d2fffee

Please sign in to comment.