---
editLink: false
lastUpdated: false
outline: [2, 3]
---

<!-- Generated by python/b2c-tooling-sdk/scripts/generate_api_docs.py. Do not edit. -->

# b2c_tooling_sdk.errors

Error types for B2C tooling operations.

## Classes

### HttpError {#httperror}

```python
class HttpError(Exception)
```

Raised when an HTTP request fails.

Wraps the original `httpx.Response` for access to status, headers,
and body. Mirrors `HTTPError` in the TypeScript SDK.

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `response` |  | The response object from the failed request. |
| `method` |  | HTTP method used for the request (GET, POST, PUT, ...). |

### NetworkError {#networkerror}

```python
class NetworkError(Exception)
```

Raised when a network-layer request fails.

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `kind` | `NetworkErrorKind` | Classified network error kind. |
| `operation` |  | Description of the operation that failed. |
| `host` |  | Target hostname. |

## Functions

### classify_network_error {#classify-network-error}

```python
def classify_network_error(err: BaseException) -> NetworkErrorKind
```

Classify a transport failure into a [`NetworkErrorKind`](/python/api/errors#networkerrorkind).

### describe_network_error_kind {#describe-network-error-kind}

```python
def describe_network_error_kind(kind: NetworkErrorKind) -> tuple[str, str]
```

Return a `(summary, hint)` pair for a network error kind.

### is_network_error {#is-network-error}

```python
def is_network_error(err: BaseException) -> bool
```

Return `True` for transport-level failures; `False` for HTTP/application errors.

[`HttpError`](/python/api/errors#httperror) always returns `False`
so it passes through [`wrap_network_error`](/python/api/errors#wrap-network-error) untouched.

### wrap_network_error {#wrap-network-error}

```python
def wrap_network_error(err: BaseException, *, operation: str | None = None, host: str | None = None) -> BaseException
```

Wrap a transport failure in a [`NetworkError`](/python/api/errors#networkerror) with actionable context.

Returns the wrapped error (or the original error unchanged if it is not a
network error, or already a fully-contextualized [`NetworkError`](/python/api/errors#networkerror)).
This function does **not** raise — the caller must raise the result.

## Attributes

### NetworkErrorKind {#networkerrorkind}

```python
NetworkErrorKind = Literal['timeout', 'connection-reset', 'connection-refused', 'dns', 'tls', 'aborted', 'unknown']
```
