"""Custom error class for MongolChat API errors."""

from typing import Any, Optional


class MongolChatError(Exception):
    """MongolChat API error.

    Includes the API response code and raw response body when available.
    """

    def __init__(
        self,
        message: str,
        code: Optional[int] = None,
        response: Optional[Any] = None,
    ) -> None:
        super().__init__(message)
        self.code = code
        self.response = response
