Something went wrong. Try again.
Send a link from your phone's share sheet and have it open automatically on another device.
Something went wrong. Try again.
123456789101112131415161718192021// Human-readable messages for errors surfaced in the UI.//// @atproto/oauth-client wraps failures in its own error types (an// OAuthResolverError around a fetch or DID-resolution failure, say), and the// outer message is usually the generic one — "Failed to resolve identity"// rather than what actually went wrong. Walking the `cause` chain is what makes// a sign-in failure diagnosable from the screen instead of the debugger.
export function errorMessage(e: unknown): string { const parts: string[] = []; let cur: unknown = e; // Guard against a cyclic cause chain, which would otherwise loop forever. const seen = new Set<unknown>(); while (cur && !seen.has(cur)) { seen.add(cur); parts.push(cur instanceof Error ? cur.message : String(cur)); cur = cur instanceof Error ? (cur as { cause?: unknown }).cause : undefined; } return parts.join(" ‹cause› ");}