2026-04-06 12:41:49 +01:00
|
|
|
"""
|
2026-05-28 11:22:12 +01:00
|
|
|
Exceptions related to the contact module
|
2026-04-06 12:41:49 +01:00
|
|
|
|
2026-05-28 11:22:12 +01:00
|
|
|
Exports:
|
|
|
|
|
- ContactNotFoundException: Takes an optional contact ID int
|
2026-05-27 14:58:10 +01:00
|
|
|
"""
|
|
|
|
|
from typing import Optional
|
|
|
|
|
|
|
|
|
|
from fastapi import HTTPException, status
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ContactNotFoundException(HTTPException):
|
|
|
|
|
def __init__(self, contact_id: Optional[int] = None) -> None:
|
|
|
|
|
detail = "Contact not found" if contact_id is None else f"Contact with ID '{contact_id}' was not found."
|
|
|
|
|
super().__init__(
|
|
|
|
|
status_code=status.HTTP_404_NOT_FOUND,
|
|
|
|
|
detail=detail,
|
|
|
|
|
)
|