1
0
Fork 0
forked from sr2/cloud-api
cloud-api/src/service/exceptions.py
luxferre c689ac1e10 minor: ruff formatter
All changes are either:
- Correcting tabs
- Adding/removing line breaks
- Adding trailing commas
2026-06-08 15:31:37 +01:00

23 lines
515 B
Python

"""
Exceptions related to the services module
Exceptions:
- ServiceNotFoundException: Takes an optional service_id int
"""
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,
)