ErrorCode
ErrorCode is the machine-readable code carried by every *Error (PROTOCOL §7).
On this page
ErrorCode is the machine-readable code carried by every *Error (PROTOCOL §7).
type ErrorCode stringConstants#
Error codes (PROTOCOL §7). Network and server problems never surface as errors from GetFinancialContribution; see the package documentation for the full contract.
CodeInvalidConfig#
const CodeInvalidConfig ErrorCode = "invalid_config"CodeInvalidConfig: missing or invalid configuration, including targets that do not exist (dev-time check) and invalid checkout options.
CodeDisabled#
const CodeDisabled ErrorCode = "disabled"CodeDisabled: Sponsorkit is disabled with SPONSORKIT_DISABLE.
CodePopupBlocked#
const CodePopupBlocked ErrorCode = "popup_blocked"CodePopupBlocked is used by browser SDKs only. It is listed for completeness.
CodeAccessDenied#
const CodeAccessDenied ErrorCode = "access_denied"CodeAccessDenied: the user denied access at the provider.
CodeInvalidState#
const CodeInvalidState ErrorCode = "invalid_state"CodeInvalidState: the sign-in state expired or was invalid.
CodeProviderError#
const CodeProviderError ErrorCode = "provider_error"CodeProviderError: the provider failed during sign-in.
CodeInvalidCode#
const CodeInvalidCode ErrorCode = "invalid_code"CodeInvalidCode: the API rejected the sign-in code exchange (400 invalid_code: malformed, expired or wrong verifier).
CodeCancelled#
const CodeCancelled ErrorCode = "cancelled"CodeCancelled: the sign-in was abandoned or its context.Context was cancelled. Err wraps the context error when there is one.
CodeTimeout#
const CodeTimeout ErrorCode = "timeout"CodeTimeout: the sign-in took longer than Options.SignInTimeout (default 5 minutes).
CodeNetworkError#
const CodeNetworkError ErrorCode = "network_error"CodeNetworkError: Sponsorkit could not be reached, or answered 5xx, 429 or an unexpected response, during SignIn or VerifySession. RetryAfter is set when the API sent Retry-After.
CodeSessionInvalid#
const CodeSessionInvalid ErrorCode = "session_invalid"CodeSessionInvalid: only from VerifySession. The token is invalid or expired.
CodeTargetsMismatch#
const CodeTargetsMismatch ErrorCode = "targets_mismatch"CodeTargetsMismatch: only from VerifySession. The session belongs to a different target set.
Functions#
ErrorCodeOf#
func ErrorCodeOf(err error) ErrorCodeErrorCodeOf returns the Code of err if it is (or wraps) an *Error, and "" otherwise.