// One place to turn a typed API error (or any transport failure) into a sentence. export const errorText = (error: unknown): string => { if (typeof error === "object" && error !== null) { const e = error as { _tag?: string; issues?: string; message?: string; reason?: unknown; }; if (e._tag === "ConfigInvalid" && typeof e.issues === "string") { return e.issues; } if (e._tag === "SyncInProgress") return "A sync pass is already running"; if (typeof e.message === "string" && e.message.length > 0) return e.message; if (typeof e._tag === "string") return e._tag; } return String(error); };