turnkey-sdk-types 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ from .errors import *
2
+ from .types import *
3
+ from .generated.types import *
@@ -0,0 +1,41 @@
1
+ """Turnkey SDK error classes."""
2
+
3
+ from enum import Enum
4
+ from typing import Optional, Any
5
+
6
+
7
+ class TurnkeyErrorCodes(str, Enum):
8
+ """Error codes for Turnkey API errors."""
9
+
10
+ NETWORK_ERROR = "NETWORK_ERROR"
11
+ BAD_RESPONSE = "BAD_RESPONSE"
12
+
13
+
14
+ class TurnkeyError(Exception):
15
+ """Base exception for Turnkey SDK errors."""
16
+
17
+ def __init__(
18
+ self,
19
+ message: str,
20
+ code: Optional[TurnkeyErrorCodes] = None,
21
+ cause: Optional[Any] = None,
22
+ ):
23
+ super().__init__(message)
24
+ self.name = "TurnkeyError"
25
+ self.code = code
26
+ self.cause = cause
27
+
28
+
29
+ class TurnkeyNetworkError(TurnkeyError):
30
+ """Exception raised for network-related errors."""
31
+
32
+ def __init__(
33
+ self,
34
+ message: str,
35
+ status_code: Optional[int] = None,
36
+ code: Optional[TurnkeyErrorCodes] = None,
37
+ cause: Optional[Any] = None,
38
+ ):
39
+ super().__init__(message, code, cause)
40
+ self.name = "TurnkeyNetworkError"
41
+ self.status_code = status_code