ErrorCode
Every value SponsorkitError.code can take.
Type alias in sponsorkit.errors.
from sponsorkit import ErrorCodeAlso importable from sponsorkit.errors.
ErrorCode = Literal[
"invalid_config",
"disabled",
"popup_blocked",
"access_denied",
"invalid_state",
"provider_error",
"invalid_code",
"cancelled",
"timeout",
"network_error",
"session_invalid",
"targets_mismatch",
]Every value SponsorkitError.code can take.
invalid_config: no targets, a malformed target, an invalid option (including invalidcheckout_url()options), an unknown mock preset, an unwritable storage directory, or (dev-time check) a target that does not exist.disabled:SPONSORKIT_DISABLEis set; raised by sign-in and checkout.popup_blocked: browser SDKs only; never raised by the Python SDK.access_denied/invalid_state/provider_error: sign-in errors delivered by the sign-in page to the loopback callback.invalid_code: the API rejected the code exchange (400 invalid_code: malformed, expired or tampered code, or a verifier mismatch).cancelled: sign-in was cancelled through itscancelevent, or the user entered no code at the paste-back prompt. Cancelling the task that awaitsasign_in()oraopen_checkout()raisesasyncio.CancelledErrorinstead.timeout: sign-in did not complete withinsign_in_timeout(300 s by default) or thetimeoutpassed to that call.network_error: sign-in orverify_session()could not reach the API, or it answered5xx,429or something unexpected.SponsorkitError.retry_aftercarries the API'sRetry-Afterin seconds when it sent one.session_invalid/targets_mismatch: only raised bysponsorkit.server.verify_session().
get_financial_contribution() never raises for network or server problems.
Values#
| Value |
|---|
"invalid_config" |
"disabled" |
"popup_blocked" |
"access_denied" |
"invalid_state" |
"provider_error" |
"invalid_code" |
"cancelled" |
"timeout" |
"network_error" |
"session_invalid" |
"targets_mismatch" |