-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexceptions.py
53 lines (32 loc) · 1.59 KB
/
exceptions.py
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""PyPetkit exceptions."""
from __future__ import annotations
class PypetkitError(Exception):
"""Class for PyPetkit exceptions."""
class PetkitTimeoutError(PypetkitError):
"""Class for PyPetkit timeout exceptions."""
class PetkitSessionError(PypetkitError):
"""Class for PyPetkit connection exceptions."""
class PetkitSessionExpiredError(PypetkitError):
"""Class for PyPetkit connection exceptions."""
class PetkitAuthenticationUnregisteredEmailError(PypetkitError):
"""Exception raised when the email is not registered with Petkit."""
def __init__(self):
"""Initialize the exception."""
self.message = "The email you provided is not registered on Petkit's servers. Please check your email, or you are using the correct region."
super().__init__(self.message)
class PetkitRegionalServerNotFoundError(PypetkitError):
"""Exception raised when the specified region server is not found."""
def __init__(self, region: str):
"""Initialize the exception."""
self.region = region
self.message = (
f"Region you provided: '{region}' was not found in the Petkit's server list. "
f"Are you sure you provided the correct region ?"
)
super().__init__(self.message)
class PetkitInvalidHTTPResponseCodeError(PypetkitError):
"""Class for PyPetkit invalid HTTP Response exceptions."""
class PetkitInvalidResponseFormat(PypetkitError):
"""Class for PyPetkit invalid Response Format exceptions."""
class PetkitAuthenticationError(PypetkitError):
"""Class for PyPetkit authentication exceptions."""