Files
kapteins-daagbok/client/src/utils/errors.ts
T
elpatron 9089d017b6 feat(ux): Sprint 3 mobile nav, sync conflicts, and resilience
Improve mobile bottom navigation, accessible dialogs and cards, explicit
sync conflict resolution, i18n error messages, encrypted draft autosave,
and persistent storage hints for offline data safety.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:30:08 +02:00

11 lines
314 B
TypeScript

/** Map unknown errors to a user-facing message (i18n key or fallback). */
export function getErrorMessage(err: unknown, fallback: string): string {
if (err instanceof Error && err.message.trim()) {
return err.message
}
if (typeof err === 'string' && err.trim()) {
return err
}
return fallback
}