|
@@ -3,14 +3,18 @@ package org.hswebframework.web.exception;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.Getter;
|
|
|
import lombok.Setter;
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
+import org.springframework.web.bind.annotation.ResponseStatus;
|
|
|
|
|
|
import javax.validation.ConstraintViolation;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
import java.util.Set;
|
|
|
|
|
|
@Getter
|
|
|
@Setter
|
|
|
+@ResponseStatus(HttpStatus.BAD_REQUEST)
|
|
|
public class ValidationException extends BusinessException {
|
|
|
|
|
|
private List<Detail> details;
|
|
@@ -19,6 +23,10 @@ public class ValidationException extends BusinessException {
|
|
|
super(message);
|
|
|
}
|
|
|
|
|
|
+ public ValidationException(String property, String message) {
|
|
|
+ this(message, Collections.singletonList(new Detail(property, message, null)));
|
|
|
+ }
|
|
|
+
|
|
|
public ValidationException(String message, List<Detail> details) {
|
|
|
super(message);
|
|
|
this.details = details;
|