File size: 1,764 Bytes
54eb2ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
class UserNotVerifiedError(Exception):
    """Exception raised when a user is not verified."""

    def __init__(self, message: str = "User is not verified."):
        self.message = message
        super().__init__(self.message)


class InvalidCredentialsError(Exception):
    """Exception raised for invalid authentication credentials."""

    def __init__(self, message: str = "Invalid credentials provided."):
        self.message = message
        super().__init__(self.message)


class TokenExpiredError(Exception):
    """Exception raised when an authentication token has expired."""

    def __init__(self, message: str = "Authentication token has expired."):
        self.message = message
        super().__init__(self.message)


class PermissionDeniedError(Exception):
    """Exception raised when a user does not have permission to access a resource."""

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


class UserAlreadyExistsError(Exception):
    """Exception raised when trying to create a user that already exists."""

    def __init__(self, message: str = "User already exists."):
        self.message = message
        super().__init__(self.message)


class InvalidTokenError(Exception):
    """Exception raised for invalid authentication tokens."""

    def __init__(self, message: str = "Invalid authentication token."):
        self.message = message
        super().__init__(self.message)

class LoginError(Exception):
    """Exception raised for login related errors."""

    def __init__(self, message: str = "Login error occurred."):
        self.message = message
        super().__init__(self.message)