aito.client.v2.errors.AitoV2Error

exception aito.client.v2.errors.AitoV2Error(message: str, code: str | None = None, status_code: int | None = None, body: Any = None)

An error occurred when calling the Aito v2 API

Carries the HTTP status, the machine-readable error code and the raw body so a caller can diagnose without a debugger.

>>> try:
...     client.predict(from_table='invoices', where={}, predict='gl_code')
... except AitoV2Error as err:
...     if err.code == 'not_found':
...         ...  # the collection does not exist yet
Parameters:
  • message (str) – the human-readable error message

  • code (Optional[str]) – the machine-readable error code, if the response carried one

  • status_code (Optional[int]) – the HTTP status code of the response, if there was a response

  • body (Any) – the raw response body