SponsorkitErrorCode

Error codes carried by SponsorkitError.

Error codes carried by SponsorkitError.

  • invalid_config: missing or invalid configuration or options (including targets that don't exist, checked at dev time).
  • disabled: Sponsorkit is disabled via SPONSORKIT_DISABLE.
  • popup_blocked: the browser blocked the sign-in/checkout popup and no redirect fallback applies.
  • access_denied, invalid_state, provider_error: sign-in errors delivered to the callback.
  • invalid_code: the API rejected the sign-in code exchange (400 invalid_code).
  • cancelled: sign-in was abandoned or cancelled (popup closed, AbortSignal aborted, no code entered).
  • timeout: sign-in exceeded signInTimeout (default 300 s).
  • network_error: the API couldn't be reached, or returned 5xx, 429 or an unexpected response, during signIn() or verifySession(). Carries SponsorkitError.retryAfter when the API sent Retry-After.
  • session_invalid, targets_mismatch: only from verifySession().

getFinancialContribution() never throws for network or server problems.

import type { SponsorkitErrorCode } from "@sponsorkit/sdk";

type SponsorkitErrorCode =
  | "invalid_config"
  | "disabled"
  | "popup_blocked"
  | "access_denied"
  | "invalid_state"
  | "provider_error"
  | "invalid_code"
  | "cancelled"
  | "timeout"
  | "network_error"
  | "session_invalid"
  | "targets_mismatch"

Type alias, exported from @sponsorkit/sdk, @sponsorkit/sdk/node, @sponsorkit/sdk/server.