18 lines
447 B
Python
18 lines
447 B
Python
"""
|
|
Module specific exceptions for the auth module
|
|
|
|
Exceptions:
|
|
- UnauthorizedException: Takes an optional message string
|
|
"""
|
|
from typing import Optional
|
|
|
|
from fastapi import HTTPException, status
|
|
|
|
|
|
class UnauthorizedException(HTTPException):
|
|
def __init__(self, message: Optional[str] = None) -> None:
|
|
detail = "Not authorized" if not message else message
|
|
super().__init__(
|
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
|
detail=detail,
|
|
)
|