From 49dfb3e82bb6d20850b4516d5d5b0d9bdfcfd8b2 Mon Sep 17 00:00:00 2001 From: Asman Date: Sat, 21 Dec 2024 03:37:31 +0300 Subject: [PATCH] fix statuses --- internal/ads/controller/ads_controller.go | 2 +- internal/cities/controller/cities_controller.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/ads/controller/ads_controller.go b/internal/ads/controller/ads_controller.go index 9ae8747..1b3102a 100644 --- a/internal/ads/controller/ads_controller.go +++ b/internal/ads/controller/ads_controller.go @@ -1094,7 +1094,7 @@ func (h *AdHandler) handleError(w http.ResponseWriter, err error, requestID stri Error: err.Error(), } switch err.Error() { - case "ad not found", "ad date not found", "image not found", "error fetching all places": + case "ad not found", "ad date not found", "image not found", "error fetching all places", "error fetching places": statusCode = http.StatusNotFound case "ad already exists", "roomsNumber out of range", "not owner of ad": statusCode = http.StatusConflict diff --git a/internal/cities/controller/cities_controller.go b/internal/cities/controller/cities_controller.go index d98c8af..bce1a58 100644 --- a/internal/cities/controller/cities_controller.go +++ b/internal/cities/controller/cities_controller.go @@ -187,7 +187,7 @@ func (h *CityHandler) handleError(w http.ResponseWriter, err error, requestID st statusCode = http.StatusBadRequest case "error fetching all cities", "error fetching city": - statusCode = http.StatusInternalServerError + statusCode = http.StatusNotFound default: statusCode = http.StatusInternalServerError }