From 47714250448e1ca249ceca74b363f20ad8126f57 Mon Sep 17 00:00:00 2001 From: zinzoddari Date: Fri, 5 Jan 2024 01:04:13 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20Status=20import=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/exception/RootExceptionHandler.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/idiot/yesslave/global/exception/RootExceptionHandler.java b/src/main/java/org/idiot/yesslave/global/exception/RootExceptionHandler.java index b5e1bf7..c84abd1 100644 --- a/src/main/java/org/idiot/yesslave/global/exception/RootExceptionHandler.java +++ b/src/main/java/org/idiot/yesslave/global/exception/RootExceptionHandler.java @@ -14,14 +14,12 @@ import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseStatus; import org.zalando.problem.Problem; +import org.zalando.problem.Status; import javax.validation.ConstraintViolationException; import java.util.ArrayList; import java.util.List; -import static org.zalando.problem.Status.BAD_REQUEST; -import static org.zalando.problem.Status.INTERNAL_SERVER_ERROR; - @Slf4j @ControllerAdvice @EnableAutoConfiguration(exclude = ErrorMvcAutoConfiguration.class) @@ -36,8 +34,8 @@ public ResponseEntity exceptionHandler(Exception e) { log.error("[ 500 ERROR ] : ", e); Problem problem = Problem.builder() - .withStatus(INTERNAL_SERVER_ERROR) - .withTitle(INTERNAL_SERVER_ERROR.getReasonPhrase()) + .withStatus(Status.INTERNAL_SERVER_ERROR) + .withTitle(Status.INTERNAL_SERVER_ERROR.getReasonPhrase()) .withDetail(e.getMessage()) .build(); @@ -63,8 +61,8 @@ public ResponseEntity methodArgumentNotValidExceptionHandler(MethodArgu }); Problem problem = Problem.builder() - .withStatus(BAD_REQUEST) - .withTitle(BAD_REQUEST.getReasonPhrase()) + .withStatus(Status.BAD_REQUEST) + .withTitle(Status.BAD_REQUEST.getReasonPhrase()) .with("parameters", responses) .build(); @@ -88,8 +86,8 @@ public Problem constraintViolationExceptionHandler(ConstraintViolationException }); return Problem.builder() - .withStatus(BAD_REQUEST) - .withTitle(BAD_REQUEST.getReasonPhrase()) + .withStatus(Status.BAD_REQUEST) + .withTitle(Status.BAD_REQUEST.getReasonPhrase()) .with("parameters", responses) .build(); }