akiflow.exceptions

Exception hierarchy for the Akiflow SDK.

 1"""Exception hierarchy for the Akiflow SDK."""
 2
 3
 4class AkiflowError(Exception):
 5    """Base exception for all Akiflow SDK errors."""
 6
 7
 8class AuthError(AkiflowError):
 9    """Raised when authentication fails (bad OTP, expired link, etc.)."""
10
11
12class APIError(AkiflowError):
13    """Raised on non-2xx responses from the Akiflow API.
14
15    Attributes:
16        status_code: HTTP status code.
17        message: Error message from the response body.
18    """
19
20    def __init__(self, status_code: int, message: str):
21        self.status_code = status_code
22        self.message = message
23        super().__init__(f"HTTP {status_code}: {message}")
24
25
26class TokenExpiredError(APIError):
27    """Raised when the access token is expired and cannot be refreshed.
28
29    This typically means the refresh token has also expired or was revoked.
30    Re-authenticate with `Akiflow(email=...)` to get new tokens.
31    """
class AkiflowError(builtins.Exception):
5class AkiflowError(Exception):
6    """Base exception for all Akiflow SDK errors."""

Base exception for all Akiflow SDK errors.

class AuthError(AkiflowError):
 9class AuthError(AkiflowError):
10    """Raised when authentication fails (bad OTP, expired link, etc.)."""

Raised when authentication fails (bad OTP, expired link, etc.).

class APIError(AkiflowError):
13class APIError(AkiflowError):
14    """Raised on non-2xx responses from the Akiflow API.
15
16    Attributes:
17        status_code: HTTP status code.
18        message: Error message from the response body.
19    """
20
21    def __init__(self, status_code: int, message: str):
22        self.status_code = status_code
23        self.message = message
24        super().__init__(f"HTTP {status_code}: {message}")

Raised on non-2xx responses from the Akiflow API.

Attributes: status_code: HTTP status code. message: Error message from the response body.

APIError(status_code: int, message: str)
21    def __init__(self, status_code: int, message: str):
22        self.status_code = status_code
23        self.message = message
24        super().__init__(f"HTTP {status_code}: {message}")
status_code
message
class TokenExpiredError(APIError):
27class TokenExpiredError(APIError):
28    """Raised when the access token is expired and cannot be refreshed.
29
30    This typically means the refresh token has also expired or was revoked.
31    Re-authenticate with `Akiflow(email=...)` to get new tokens.
32    """

Raised when the access token is expired and cannot be refreshed.

This typically means the refresh token has also expired or was revoked. Re-authenticate with Akiflow(email=...) to get new tokens.

Inherited Members
APIError
APIError
status_code
message