"""Custom exceptions for the Sigil SDK."""

from __future__ import annotations


class SigilError(Exception):
    """Base exception for Sigil SDK errors."""

    def __init__(self, message: str, status_code: int | None = None) -> None:
        self.message = message
        self.status_code = status_code
        super().__init__(message)

    def __str__(self) -> str:
        if self.status_code:
            return f"[{self.status_code}] {self.message}"
        return self.message


class SigilNotFoundError(SigilError):
    """Raised when a persona is not found (404)."""

    def __init__(self, message: str = "Persona not found") -> None:
        super().__init__(message, status_code=404)


class SigilAuthError(SigilError):
    """Raised when authentication fails (401)."""

    def __init__(self, message: str = "Authentication failed") -> None:
        super().__init__(message, status_code=401)
