diff --git a/backend/ddang/src/main/java/com/ddang/ddang/auction/presentation/dto/request/CreateAuctionRequest.java b/backend/ddang/src/main/java/com/ddang/ddang/auction/presentation/dto/request/CreateAuctionRequest.java index 7a0d51ddd..753fff9b5 100644 --- a/backend/ddang/src/main/java/com/ddang/ddang/auction/presentation/dto/request/CreateAuctionRequest.java +++ b/backend/ddang/src/main/java/com/ddang/ddang/auction/presentation/dto/request/CreateAuctionRequest.java @@ -4,6 +4,7 @@ import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Positive; + import java.time.LocalDateTime; import java.util.List; @@ -15,11 +16,11 @@ public record CreateAuctionRequest( String description, @NotNull(message = "입찰 단위가 입력되지 않았습니다.") - @Positive(message = "금액은 음수를 입력할 수 없습니다.") + @Positive(message = "금액은 양수로 입력해주세요.") Integer bidUnit, @NotNull(message = "시작가가 입력되지 않았습니다.") - @Positive(message = "금액은 음수를 입력할 수 없습니다.") + @Positive(message = "금액은 양수로 입력해주세요.") Integer startPrice, @NotNull(message = "마감 시간이 입력되지 않았습니다.") @@ -27,7 +28,7 @@ public record CreateAuctionRequest( LocalDateTime closingTime, @NotNull(message = "하위 카테고리가 입력되지 않았습니다.") - @Positive(message = "카테고리 아이디는 음수 또는 0을 입력할 수 없습니다.") + @Positive(message = "잘못된 카테고리 입니다.") Long subCategoryId, List thirdRegionIds diff --git a/backend/ddang/src/main/java/com/ddang/ddang/exception/GlobalExceptionHandler.java b/backend/ddang/src/main/java/com/ddang/ddang/exception/GlobalExceptionHandler.java index e0749c2b3..be1e3504a 100644 --- a/backend/ddang/src/main/java/com/ddang/ddang/exception/GlobalExceptionHandler.java +++ b/backend/ddang/src/main/java/com/ddang/ddang/exception/GlobalExceptionHandler.java @@ -30,7 +30,6 @@ import com.ddang.ddang.report.application.exception.InvalidReportAuctionException; import com.ddang.ddang.report.application.exception.InvalidReporterToAuctionException; import com.ddang.ddang.user.application.exception.UserNotFoundException; -import org.springframework.context.support.DefaultMessageSourceResolvable; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatusCode; @@ -42,7 +41,6 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; import java.net.MalformedURLException; -import java.util.stream.Collectors; @RestControllerAdvice public class GlobalExceptionHandler extends ResponseEntityExceptionHandler { @@ -97,7 +95,7 @@ public ResponseEntity handleMessageNotFoundException(final Me @ExceptionHandler(UnableToChatException.class) public ResponseEntity handleUnableToChatException(final UnableToChatException ex) { - logger.warn(String.format(EXCEPTION_FORMAT, MessageNotFoundException.class), ex); + logger.warn(String.format(EXCEPTION_FORMAT, UnableToChatException.class), ex); return ResponseEntity.status(HttpStatus.BAD_REQUEST) .body(new ExceptionResponse(ex.getMessage())); @@ -336,10 +334,7 @@ protected ResponseEntity handleMethodArgumentNotValid( ) { logger.info(String.format(EXCEPTION_FORMAT, MethodArgumentNotValidException.class), ex); - final String message = ex.getFieldErrors() - .stream() - .map(DefaultMessageSourceResolvable::getDefaultMessage) - .collect(Collectors.joining(System.lineSeparator())); + final String message = ex.getFieldErrors().get(0).getDefaultMessage(); return ResponseEntity.status(HttpStatus.BAD_REQUEST) .body(new ExceptionResponse(message));