Exceptions

class flame_hub._exceptions.ErrorResponse(*, name: str, code: str, status_code: int, message: str, issues: list, **extra_data: Any)

Bases: BaseModel

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}

Configuration so that extra properties may be available.

name: str

Name of the error.

code: str

Name of the error code.

status_code: int

HTTP code of the response.

message: str

The error message.

issues: list

List of issues.

class flame_hub.HubAPIError(message: str, request: Request, error: ErrorResponse = None)

Bases: HTTPError

Base error for any unexpected response returned by the Hub API.

Parameters:
messagestr

The error message.

requesthttpx.Request

The request which caused the error.

errorErrorResponse, optional

Parsed response to enrich the error with additional information.

flame_hub._exceptions.new_hub_api_error_from_response(r: Response) HubAPIError

Create a new HubAPIError from a response.

If present, this function will use the response body to add context to the error message. The response body is parsed by the ErrorResponse model and is available using the error_response property of the returned error.

Parameters:
rhttpx.Response

The response to create a new HubAPIError for.

Returns:
HubAPIError

A new HubAPIError instance which is enriched with information from the response r.