import { OAuthResponseError, TokenRefreshError } from "@atcute/oauth-browser-client";
// a refresh that the pds rejected outright, the session is gone and only a new
// authorization brings it back. anything else (network, 5xx) is transient.
export const isDeadSessionError = (cause: unknown): boolean =>
cause instanceof TokenRefreshError ||
(cause instanceof OAuthResponseError &&
cause.status === 400 &&
(cause.error === "invalid_grant" || cause.error === "invalid_token"));