svelte refactor

This commit is contained in:
Bradley Nelson
2026-06-17 22:30:56 -06:00
parent 89e14f8f9e
commit e6279da5ce
26 changed files with 497 additions and 386 deletions
+15
View File
@@ -0,0 +1,15 @@
/** Error-handling helpers shared across pages and components. */
import { ui } from '$lib/stores/ui.svelte';
/** Normalise an unknown thrown value into a human-readable message. */
export function errorMessage(e: unknown): string {
return e instanceof Error ? e.message : String(e);
}
/**
* Raise an error toast for a caught value — the canonical catch-block handler.
* Replaces the repeated `ui.notify(e instanceof Error ? e.message : String(e), 'error')`.
*/
export function errorToast(e: unknown): void {
ui.notify(errorMessage(e), 'error');
}