Exceptions#
The exceptions that CyteType defines all derive from CyteTypeError. Errors that the
server reports derive from APIError: the class tells you what went wrong, and
error_code holds the server’s error code. NetworkError means that the server could not
be reached or answered unexpectedly, and CyteTypeTimeoutError that a request or the wait
for a job took too long. Import them from cytetype:
from cytetype import CyteTypeError, QuotaExceededError
try:
adata = annotator.run(study_context="Human PBMCs from a healthy donor.")
except QuotaExceededError as error:
print(error.error_code, error.message)
CyteTypeTimeoutError is the client’s own TimeoutError class from
cytetype.api.exceptions. The package exports it under this name so that
from cytetype import * does not hide Python’s built-in TimeoutError.
cytetype.api exports the class as CyteTypeTimeoutError and, as in earlier releases,
as TimeoutError, so from cytetype.api import * does hide the built-in class.
Errors and error codes explains what to do about each error.
- exception cytetype.CyteTypeError(message, error_code=None)#
Bases:
ExceptionBase exception for all CyteType errors.
- message: str#
The error message.
- error_code: str | None#
The machine-readable error code, such as
QUOTA_EXCEEDED, orNoneif the error has none.
- exception cytetype.APIError(message, error_code=None)#
Bases:
CyteTypeErrorBase class for API-related errors.
- exception cytetype.AuthenticationError(message, error_code=None)#
Bases:
APIErrorAuthentication failed - INVALID_TOKEN, TOKEN_INACTIVE, AUTHENTICATION_REQUIRED.
- exception cytetype.AuthorizationError(message, error_code=None)#
Bases:
APIErrorAuthorization failed - ACCESS_DENIED, LICENSE_EXPIRED, VPN_BLOCKED.
- exception cytetype.RateLimitError(message, error_code=None)#
Bases:
APIErrorRate limit exceeded - RATE_LIMIT_EXCEEDED.
- exception cytetype.QuotaExceededError(message, error_code=None)#
Bases:
APIErrorQuota exceeded - QUOTA_EXCEEDED.
- exception cytetype.JobNotFoundError(message, error_code=None)#
Bases:
APIErrorJob not found - JOB_NOT_FOUND.
- exception cytetype.JobFailedError(message, error_code=None)#
Bases:
APIErrorJob failed - JOB_FAILED.
- exception cytetype.LLMValidationError(message, error_code=None)#
Bases:
APIErrorLLM validation failed - LLM_VALIDATION_FAILED.
- exception cytetype.ClientDisconnectedError(message, error_code=None)#
Bases:
APIErrorServer detected client disconnection mid-request - CLIENT_DISCONNECTED (HTTP 499).
- exception cytetype.NetworkError(message='Network connection failed', error_code=None)#
Bases:
CyteTypeErrorNetwork connectivity issue.
- exception cytetype.CyteTypeTimeoutError(message='Request timed out', error_code=None)#
Bases:
CyteTypeErrorClient-side timeout waiting for results.