Source code for reminix.client.exceptions
"""Custom exceptions for Reminix SDK"""
from typing import Any, Dict, Optional
[docs]
class ReminixError(Exception):
"""Base exception for all Reminix SDK errors"""
[docs]
def __init__(self, message: str, cause: Optional[Exception] = None):
super().__init__(message)
self.message = message
self.cause = cause
[docs]
class APIError(ReminixError):
"""Exception raised when an API request fails"""
[docs]
def __init__(
self,
message: str,
status: int,
status_text: str,
response: Optional[Dict[str, Any]] = None,
):
super().__init__(message)
self.status = status
self.status_text = status_text
self.response = response
[docs]
class AuthenticationError(APIError):
"""Exception raised when authentication fails (401/403)"""
[docs]
def __init__(
self,
message: str = "Authentication failed. Please check your API key.",
status: int = 401,
response: Optional[Dict[str, Any]] = None,
):
super().__init__(message, status, "Unauthorized", response)
[docs]
class NetworkError(ReminixError):
"""Exception raised when a network error occurs"""
[docs]
def __init__(self, message: str, cause: Optional[Exception] = None):
super().__init__(message, cause)