Skip to content

Commit

Permalink
refactor: Status import 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
zinzoddari committed Jan 4, 2024
1 parent d192e0a commit 4771425
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -36,8 +34,8 @@ public ResponseEntity<Problem> 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();

Expand All @@ -63,8 +61,8 @@ public ResponseEntity<Problem> 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();

Expand All @@ -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();
}
Expand Down

0 comments on commit 4771425

Please sign in to comment.