File: exceptions.py

package info (click to toggle)
python-gcal-sync 9.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 436 kB
  • sloc: python: 5,289; sh: 9; makefile: 5
file content (37 lines) | stat: -rw-r--r-- 1,183 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""Library for exceptions using the Google Calendar API."""


class GoogleCalendarException(Exception):
    """Base class for all client exceptions."""


class ApiException(GoogleCalendarException):
    """Raised during problems talking to the API."""


class AuthException(ApiException):
    """Raised due to auth problems talking to API."""


class InvalidSyncTokenException(ApiException):
    """Raised when the sync token is invalid."""


class ApiForbiddenException(ApiException):
    """Raised due to permission errors talking to API."""


class CalendarParseException(ApiException):
    """Raised when parsing a calendar event fails.

    The 'message' attribute contains a human-readable message about the
    error that occurred. The 'detailed_error' attribute can provide additional
    information about the error, such as a stack trace or detailed parsing
    information, useful for debugging purposes.
    """

    def __init__(self, message: str, *, detailed_error: str | None = None) -> None:
        """Initialize the CalendarParseError with a message."""
        super().__init__(message)
        self.message = message
        self.detailed_error = detailed_error