Skip to content

Commit

Permalink
Create exceptions.py
Browse files Browse the repository at this point in the history
  • Loading branch information
osama-ata authored Nov 6, 2024
1 parent fc37abf commit 7477ef1
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/siwar/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""
Exceptions for the Siwar API wrapper.
"""

class SiwarAPIError(Exception):
"""Base exception for Siwar API errors."""

def __init__(self, message: str):
self.message = message
super().__init__(self.message)


class SiwarAuthError(SiwarAPIError):
"""Raised when authentication with the API fails."""
pass


class SiwarValueError(SiwarAPIError):
"""Raised when invalid values are provided to API methods."""
pass


class SiwarResponseError(SiwarAPIError):
"""Raised when API response cannot be parsed."""
pass


class SiwarTimeoutError(SiwarAPIError):
"""Raised when API request times out."""
pass


class SiwarRateLimitError(SiwarAPIError):
"""Raised when API rate limit is exceeded."""
pass

0 comments on commit 7477ef1

Please sign in to comment.