"""Custom error classes for the Pass payment SDK."""

from typing import Any, Optional


class PassError(Exception):
    """Custom error class for Pass API errors.

    Includes error code, level, body from the API response,
    plus the HTTP status code and raw response when available.

    Attributes:
        message: Human-readable error description.
        code: Error code from the API.
        level: Error level from the API.
        body: Error body/message from the API.
        status_code: HTTP status code, if available.
        response: Raw response body, if available.
    """

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