From 29b811bc173b0922a5a8a3cb8c0985ae20348dab Mon Sep 17 00:00:00 2001 From: Jaewon Lee Date: Wed, 18 Sep 2024 15:29:39 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20weather=20api=20error=20status=20code?= =?UTF-8?q?=EB=A5=BC=20503=EC=9C=BC=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/dnd/runus/global/exception/type/ErrorType.java | 2 +- .../dnd/runus/presentation/v1/weather/WeatherController.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/dnd/runus/global/exception/type/ErrorType.java b/src/main/java/com/dnd/runus/global/exception/type/ErrorType.java index b877c9a4..0578fe2a 100644 --- a/src/main/java/com/dnd/runus/global/exception/type/ErrorType.java +++ b/src/main/java/com/dnd/runus/global/exception/type/ErrorType.java @@ -46,7 +46,7 @@ public enum ErrorType { GOAL_TIME_AND_DISTANCE_BOTH_EXIST(BAD_REQUEST, "RUNNING_004", "개인 목표 시간과 거리 중 하나만 설정해야 합니다."), // WeatherErrorType - WEATHER_API_ERROR(INTERNAL_SERVER_ERROR, "WEATHER_001", "날씨 API 호출 중 오류가 발생했습니다"), + WEATHER_API_ERROR(SERVICE_UNAVAILABLE, "WEATHER_001", "날씨 API 호출 중 오류가 발생했습니다"), ; private final HttpStatus httpStatus; private final String code; diff --git a/src/main/java/com/dnd/runus/presentation/v1/weather/WeatherController.java b/src/main/java/com/dnd/runus/presentation/v1/weather/WeatherController.java index a84aa97c..6b2fe5cd 100644 --- a/src/main/java/com/dnd/runus/presentation/v1/weather/WeatherController.java +++ b/src/main/java/com/dnd/runus/presentation/v1/weather/WeatherController.java @@ -1,6 +1,8 @@ package com.dnd.runus.presentation.v1.weather; import com.dnd.runus.application.weather.WeatherService; +import com.dnd.runus.global.exception.type.ApiErrorType; +import com.dnd.runus.global.exception.type.ErrorType; import com.dnd.runus.presentation.v1.weather.dto.WeatherResponse; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -17,6 +19,7 @@ public class WeatherController { @GetMapping @ResponseStatus(HttpStatus.OK) + @ApiErrorType({ErrorType.WEATHER_API_ERROR}) @Operation(summary = "날씨 정보 조회", description = "경도와 위도를 입력받아 날씨 정보를 조회합니다.") public WeatherResponse getWeather(@RequestParam double longitude, @RequestParam double latitude) { return weatherService.getWeather(longitude, latitude);