# 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: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
