From 449e2b2ce44b229b6bac8def2bf3fefa88223282 Mon Sep 17 00:00:00 2001 From: Helldragon67 Date: Tue, 10 Dec 2024 16:26:53 +0100 Subject: [PATCH] more error catching --- backend/src/main.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/src/main.py b/backend/src/main.py index 2cc558f..9961178 100644 --- a/backend/src/main.py +++ b/backend/src/main.py @@ -134,5 +134,10 @@ def get_landmark(landmark_uuid: str) -> Landmark: landmark = cache_client.get(f"landmark_{landmark_uuid}") return landmark except KeyError as exc: - raise HTTPException(status_code=404, - detail="Landmark not found") from exc + raise HTTPException(status_code=404, detail="Landmark not found") from exc + except ConnectionError as exc: + raise HTTPException(status_code=503, detail="Service unavailable") from exc + except TimeoutError as exc: + raise HTTPException(status_code=504, detail="Request timed out") from exc + except Exception as exc: + raise HTTPException(status_code=500, detail="An unexpected error occurred") from exc