LiumInsufficientBalanceError
from lium.sdk import LiumInsufficientBalanceError
Defined in lium.sdk.exceptions.
The account cannot pay for this (403 with a balance reason).
required and available are the USD amounts printed in the server's
refusal, when present, else None; available keeps the sign of a
negative balance. The server refuses a balance at or
below the unrounded cost, so a balance equal to required can still be
refused. Callers that catch
LiumPermissionError keep working; ones that want the numbers catch
this class.
LiumInsufficientBalanceError(
message: str,
*,
required: float | None = None,
available: float | None = None,
code: str | None = None,
hint: str | None = None,
request_id: str | None = None
)
Catching it
LiumInsufficientBalanceError subclasses LiumPermissionError → LiumError → Exception, so a handler for any of those also catches it.
from lium.sdk import LiumInsufficientBalanceError
try:
... # any SDK call
except LiumInsufficientBalanceError as e:
print(e, e.code, e.hint, e.request_id)
| Field | Meaning |
|---|---|
code | machine-readable error code from the API, when it sent one |
hint | what to try next, when the API suggested something |
request_id | the API request id; quote it when you contact support |
Attributes
| Name | Type | Description |
|---|---|---|
required | ||
available |