> 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`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://dicebear.vhjan.me/reference/errors.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
