session.py
 1  from fastapi import status
 2  
 3  from .api_exception import APIException
 4  
 5  
 6  class InvalidCredentialsError(APIException):
 7      status_code = status.HTTP_401_UNAUTHORIZED
 8      detail = "Invalid credentials"
 9      description = "This user does not exist or the password is incorrect."
10  
11  
12  class SessionNotFoundError(APIException):
13      status_code = status.HTTP_404_NOT_FOUND
14      detail = "Session not found"
15      description = "This session does not exist."
16  
17  
18  class InvalidRefreshTokenError(APIException):
19      status_code = status.HTTP_401_UNAUTHORIZED
20      detail = "Invalid refresh token"
21      description = "This refresh token is invalid or the session has expired."
22  
23  
24  class UserDisabledError(APIException):
25      status_code = status.HTTP_403_FORBIDDEN
26      detail = "User disabled"
27      description = "This user has been disabled."