cloud-api/src/contact/exceptions.py
luxferre fab228bf8f
Some checks failed
ci / ruff (push) Successful in 4s
ci / ty (push) Successful in 4s
ci / tests (push) Failing after 7s
ci / build (push) Has been cancelled
minor: ruff format
Tabs -> spaces
2026-06-22 15:04:11 +01:00

23 lines
583 B
Python

"""
Exceptions related to the contact module
Exports:
- ContactNotFoundException: Takes an optional contact ID int
"""
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,
)