> For the complete documentation index, see [llms.txt](https://dicebear.vhjan.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dicebear.vhjan.me/reference/errors.md).

# Errors

## *class Error(*[*<mark style="color:blue;">Exception</mark>*](https://docs.python.org/3/library/exceptions.html#Exception)*)*

Generic error.

```python
def __init__(self,
    error_type: str = "",
    message: str = ""
) -> None
```

### *class HTTPError(*[*<mark style="color:blue;">Error</mark>*](#class-error)*)*

The API call returned an error.

```python
def __init__(self,
    dic: dict # The caught HTTP error will often be returned as a dict
) -> None
```

## *class ImageError(*[*<mark style="color:blue;">Exception</mark>*](https://docs.python.org/3/library/exceptions.html#Exception)*)*

Generic error in terms of the avatar image.

```python
def __init__(self,
    message: str = None
) -> None
```

### *class ImageValueError(*[*<mark style="color:blue;">ImageError</mark>*](#class-imageerror-exception)*)*

The avatar image has a value error.

```python
def __init__(self,
    file_name: str = None
) -> None
```

### *class ImageOSError(*[*<mark style="color:blue;">ImageError</mark>*](#class-imageerror-exception)*)*

The image cannot be written to your device.

```python
def __init__(self,
    message: str = None
) -> None
```

### *class PILError(*[*<mark style="color:blue;">ImageError</mark>*](#class-imageerror-exception)*)*

`PIL` is not installed or a DAvatar method that uses `PIL` raised an unexpected error.

```python
def __init__(self,
    message: str = "To use this function you need to install Pillow."
) -> None
```

## *class IncorrectColor(*[*<mark style="color:blue;">Exception</mark>*](https://docs.python.org/3/library/exceptions.html#Exception)*)*

The color you provided is not in hex format.

```python
def __init__(self,
    wrong_color: str = None
) -> None
```

## *class InvalidOption(*[*<mark style="color:blue;">Exception</mark>*](https://docs.python.org/3/library/exceptions.html#Exception)*)*

The option you provided is not a valid option.

```python
def __init__(self,
    wrong_option: str = None
) -> None
```

## *def log\_error()*

Manually log an error either printing the error or raising it.

```python
def log_error(
    exception: Union[Exception, str],
    raise_error: bool = False
) -> None
```

> Raises: The given `exception` if `raise_error` is set to `True`
