From 17f0cc1dcb5f45160bbf3fcf5c07ff676061945b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=95=9C=EA=B4=80=ED=9D=AC?= <85067003+limehee@users.noreply.github.com> Date: Sun, 5 May 2024 17:32:56 +0900 Subject: [PATCH] =?UTF-8?q?refactor(ExceptionHandler):=20=EC=9D=BC?= =?UTF-8?q?=EB=B6=80=20=EC=97=90=EB=9F=AC=20=EC=BD=94=EB=93=9C=EC=97=90=20?= =?UTF-8?q?=EB=8C=80=ED=95=9C=20=EC=9D=91=EB=8B=B5=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?(#331)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/global/handler/GlobalExceptionHandler.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/page/clab/api/global/handler/GlobalExceptionHandler.java b/src/main/java/page/clab/api/global/handler/GlobalExceptionHandler.java index 6c52d31b5..e420384e7 100644 --- a/src/main/java/page/clab/api/global/handler/GlobalExceptionHandler.java +++ b/src/main/java/page/clab/api/global/handler/GlobalExceptionHandler.java @@ -65,8 +65,6 @@ import java.io.FileNotFoundException; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; import java.util.NoSuchElementException; import java.util.concurrent.CompletionException; @@ -88,9 +86,9 @@ public class GlobalExceptionHandler { MethodArgumentTypeMismatchException.class, IllegalAccessException.class, }) - public ApiResponse badRequestException(HttpServletResponse response, Exception e) { - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - return ApiResponse.failure(); + public ErrorResponse badRequestException(HttpServletResponse response, Exception e) { + response.setStatus(HttpServletResponse.SC_OK); + return ErrorResponse.failure(e); } @ExceptionHandler({ @@ -126,9 +124,9 @@ public ApiResponse deniedException(HttpServletResponse response, Exception e) { NoSuchElementException.class, FileNotFoundException.class, }) - public ApiResponse> notFoundException(HttpServletResponse response, Exception e) { + public ErrorResponse notFoundException(HttpServletResponse response, Exception e) { response.setStatus(HttpServletResponse.SC_OK); - return ApiResponse.success(new ArrayList<>()); + return ErrorResponse.failure(e); } @ExceptionHandler({