/** Best-effort human text for anything thrown — SDK rejections are rarely Errors. */ export function errorMessage(err: unknown): string { if (err instanceof Error) return err.message; if (err && typeof err === "object") { const obj = err as Record; if (typeof obj.message === "string") return obj.message; if (typeof obj.error === "string") return obj.error; try { return JSON.stringify(err); } catch {} } return String(err); }