// What went wrong, in words to show a person, from whichever layer failed. // // The two backends reject differently: the REST client with an `ApiError` // (`{ error, status }`), a Tauri command with the plain string its Rust `Err` held. // A catch that reads only `.error` turns every desktop failure into its generic // fallback — "Could not upload file." when the store said exactly why. export function errorMessage(e: unknown, fallback: string): string { if (typeof e === "string" && e.trim()) return e; if (e && typeof e === "object") { const { error, message } = e as { error?: unknown; message?: unknown }; if (typeof error === "string" && error.trim()) return error; if (typeof message === "string" && message.trim()) return message; } return fallback; }