"""Error handling for enhancement service."""

from datetime import datetime, timezone
from typing import Any, Dict


class EnhancementError(Exception):
    """Base exception for enhancement errors."""
    
    def __init__(self, message: str, original_text: str = "", error_type: str = "enhancement_error", retry_count: int = 0):
        super().__init__(message)
        self.message = message
        self.original_text = original_text
        self.error_type = error_type
        self.retry_count = retry_count
        self.timestamp = datetime.now(timezone.utc)

    def to_dict(self) -> Dict[str, Any]:
        """Convert error to dictionary."""
        return {
            "message": self.message,
            "original_text": self.original_text,
            "error_type": self.error_type,
            "retry_count": self.retry_count,
            "timestamp": self.timestamp.isoformat()
        }
