---
sidebar:
  label: roboto.exceptions.http
  order: 1
title: roboto.exceptions.http
---
## Module Contents

### ClientError

```python
exception roboto.exceptions.http.ClientError(exc: urllib.error.HTTPError)
```

`from roboto.exceptions import ClientError`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/exceptions/http.py#L70-L75)

Bases: [`HttpError`](/docs/reference/python-sdk/roboto/exceptions/http#roboto.exceptions.http.HttpError)

The server rejected the request and responded with a 4xx status.

Raised by the request methods of [`HttpClient`](/docs/reference/python-sdk/roboto/http/http_client#roboto.http.http_client.HttpClient). `HttpError` says which statuses [`RobotoClient`](/docs/reference/python-sdk/roboto/http/roboto_client#roboto.http.roboto_client.RobotoClient) converts into Roboto exceptions instead.

**Parameters**

- **exc** (`urllib.error.HTTPError`)

### HttpError

```python
exception roboto.exceptions.http.HttpError(exc: urllib.error.HTTPError)
```

`from roboto.exceptions import HttpError`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/exceptions/http.py#L13-L67)

Bases: `Exception`

Base class of the exceptions the SDK raises when an HTTP response has an error status.

The request methods of [`HttpClient`](/docs/reference/python-sdk/roboto/http/http_client#roboto.http.http_client.HttpClient) (`get`, `post`, `put`, `patch` and `delete`) raise `ClientError` for a 4xx status, `ServerError` for a status of 500 or above, and this class for any other error status, once their retries are spent. You do not construct it directly.

[`RobotoClient`](/docs/reference/python-sdk/roboto/http/roboto_client#roboto.http.roboto_client.RobotoClient), which the SDK's domain classes use, converts one with status 400, 401, 403, 404, 409 or 5xx into the matching [`RobotoDomainException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoDomainException), as [`from_client_error()`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoDomainException.from_client_error) describes. Any other standard error status, such as 429, reaches its callers as this exception unchanged.

**Parameters**

- **exc** (`urllib.error.HTTPError`)

**Properties**

- **HttpError.headers** (`dict`): Headers of the response. A header sent more than once keeps its last value.

- **HttpError.msg** (`Any`): Body of the response, decoded as UTF-8 and parsed as JSON, or the decoded text when it is not JSON.

  A body that is not valid UTF-8 raises `UnicodeDecodeError` when this is read.

- **HttpError.status** (`http.HTTPStatus | None`): HTTP status of the response, or `None` if `http.HTTPStatus` defines no member for its code.

  Return type: `Optional[http.HTTPStatus]`

### ServerError

```python
exception roboto.exceptions.http.ServerError(exc: urllib.error.HTTPError)
```

`from roboto.exceptions import ServerError`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/exceptions/http.py#L78-L83)

Bases: [`HttpError`](/docs/reference/python-sdk/roboto/exceptions/http#roboto.exceptions.http.HttpError)

The server failed to handle the request and responded with a status of 500 or above.

Raised by the request methods of [`HttpClient`](/docs/reference/python-sdk/roboto/http/http_client#roboto.http.http_client.HttpClient). `HttpError` says which statuses [`RobotoClient`](/docs/reference/python-sdk/roboto/http/roboto_client#roboto.http.roboto_client.RobotoClient) converts into Roboto exceptions instead.

**Parameters**

- **exc** (`urllib.error.HTTPError`)
