Exceptions
All library errors derive from TebraError, so one except can catch everything. Specific subclasses add operation context and structured payloads.
Hierarchy
├─ TebraConfigError
├─ TebraReadOnlyError
├─ TebraAuthError
├─ TebraAPIError
├─ TebraThrottleError
├─ TebraSOAPFault
└─ TebraNotFoundError (also a
LookupError)
Catching errors
from tebra_soap_api import (
TebraAPIError,
TebraAuthError,
TebraError,
TebraThrottleError,
)
try:
patient = await client.get_patient(patient_id=119246)
except TebraAuthError as exc:
print("check credentials:", exc.operation, exc.security_response)
except TebraThrottleError as exc:
print("slow down:", exc.operation, exc.throttle_ms)
except TebraAPIError as exc:
print("Tebra said:", exc, exc.stack_trace)
except TebraError as exc:
print("other Tebra error:", exc)
Base classes
TebraError#
class TebraError(Exception)Base class for every error raised by the wrapper. Catch this to handle all library failures uniformly.
TebraConfigError#
class TebraConfigError(TebraError)Configuration is missing or invalid, for example a blank user, password, or customer_key.
.env resolution.TebraReadOnlyError#
class TebraReadOnlyError(TebraError)A mutating operation was attempted while the client is in read_only mode. The operation is rejected locally before any network request.
| Parameter | Type | Description |
|---|---|---|
operation | str | The blocked SOAP operation name. |
operation is present in WRITE_OPERATIONS and read_only=True.TebraAuthError#
class TebraAuthError(TebraError)Tebra rejected the credentials, CustomerKey, or permissions.
| Parameter | Type | Description |
|---|---|---|
operation | str | None | The SOAP operation that failed. |
security_response | dict | None | The returned security payload for diagnostics. |
IsAuthorized=False from GetCustomerIdFromKey, or any SecurityResponse flag reports failure.TebraAPIError#
class TebraAPIError(TebraError)Tebra returned ErrorResponse.IsError == True.
| Parameter | Type | Description |
|---|---|---|
operation | str | None | The SOAP operation that failed. |
stack_trace | str | None | Server-side stack trace, when supplied. |
raw_response | dict | None | The full plain-dict response. |
ErrorResponse with IsError=True.TebraThrottleError#
class TebraThrottleError(TebraError)An endpoint rate limit was hit and retries were exhausted or not applicable.
| Parameter | Type | Description |
|---|---|---|
operation | str | None | The throttled SOAP operation. |
throttle_ms | float | None | The client-side interval in milliseconds for that endpoint. |
ErrorResponse, or malformed throttle XML after the configured retries.TebraSOAPFault#
class TebraSOAPFault(TebraError)The SOAP server returned a SOAP Fault, or the response could not be parsed as expected SOAP XML.
| Parameter | Type | Description |
|---|---|---|
operation | str | None | The SOAP operation that faulted. |
code | str | None | SOAP fault code, when present. |
detail | Any | SOAP fault detail, when present. |
Fault, or an XMLParseError is not a throttle response.TebraNotFoundError#
class TebraNotFoundError(TebraError, LookupError)A requested resource could not be resolved. It is also a LookupError, so existing lookup handlers continue to work.
encounters.resolve_context finds no matching patient.