2026-05-25 09:05:17 +01:00
|
|
|
"""
|
2026-05-28 14:41:11 +01:00
|
|
|
Exceptions related to the services module
|
2026-05-25 09:05:17 +01:00
|
|
|
|
|
|
|
|
Exceptions:
|
2026-05-28 14:41:11 +01:00
|
|
|
- ServiceNotFoundException: Takes an optional service_id int
|
2026-05-27 13:43:06 +01:00
|
|
|
"""
|
|
|
|
|
from typing import Optional
|
|
|
|
|
|
|
|
|
|
from fastapi import HTTPException, status
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ServiceNotFoundException(HTTPException):
|
|
|
|
|
def __init__(self, service_id: Optional[int] = None) -> None:
|
|
|
|
|
detail = "Service not found" if service_id is None else f"Service with ID '{service_id}' was not found."
|
|
|
|
|
super().__init__(
|
|
|
|
|
status_code=status.HTTP_404_NOT_FOUND,
|
|
|
|
|
detail=detail,
|
|
|
|
|
)
|