19 lines
468 B
Python
19 lines
468 B
Python
"""
|
|
Module specific exceptions for user module
|
|
|
|
Exceptions:
|
|
- List: Description
|
|
- Exceptions: Description
|
|
"""
|
|
from typing import Optional
|
|
|
|
from fastapi import HTTPException, status
|
|
|
|
|
|
class UserNotFoundException(HTTPException):
|
|
def __init__(self, user_id: Optional[int] = None) -> None:
|
|
detail = "User not found" if user_id is None else f"User with ID '{user_id}' was not found."
|
|
super().__init__(
|
|
status_code=status.HTTP_404_NOT_FOUND,
|
|
detail=detail,
|
|
)
|