SponsorkitError
An error raised by Sponsorkit.
On this page
Exception in sponsorkit.errors.
from sponsorkit import SponsorkitErrorAlso importable from sponsorkit.errors.
class SponsorkitError(Exception):
...An error raised by Sponsorkit. Inspect code to handle it programmatically.
Example
try:
sk.sign_in()
except SponsorkitError as e:
if e.code == "access_denied":
print("Sign-in was declined at the provider.")
elif e.code == "network_error" and e.retry_after is not None:
print(f"Try again in {e.retry_after:.0f} s.")Constructor#
SponsorkitError(
code: ErrorCode,
message: str | None = None,
*,
request_id: str | None = None,
retry_after: float | None = None,
) -> None| Parameter | Type | Default | Description |
|---|---|---|---|
code | ErrorCode | required | The stable error code (see ErrorCode). |
message | str | None | None | Human-readable message; defaults to the code. |
request_id | str | None | None | The Sponsorkit-Request-Id of the failed API response, if any. |
retry_after | float | None | None | Seconds from the API's Retry-After header (network_error only). |
Attributes#
code#
code: ErrorCodeStable, machine-readable error code (see ErrorCode).
request_id#
request_id: str | NoneThe Sponsorkit-Request-Id of the failed API response, when there was one.
retry_after#
retry_after: float | Nonenetwork_error only: seconds from the API's Retry-After header, when it sent one.