Search in sources :

Example 1 with BindException

use of cn.taketoday.context.properties.bind.BindException in project today-framework by TAKETODAY.

the class BindValidationFailureAnalyzer method getBindValidationExceptionDetails.

private ExceptionDetails getBindValidationExceptionDetails(Throwable rootFailure) {
    BindValidationException validationException = findCause(rootFailure, BindValidationException.class);
    if (validationException != null) {
        BindException target = findCause(rootFailure, BindException.class);
        List<ObjectError> errors = validationException.getValidationErrors().getAllErrors();
        return new ExceptionDetails(errors, target, validationException);
    }
    cn.taketoday.validation.BindException bindException = findCause(rootFailure, cn.taketoday.validation.BindException.class);
    if (bindException != null) {
        List<ObjectError> errors = bindException.getAllErrors();
        return new ExceptionDetails(errors, bindException.getTarget(), bindException);
    }
    return null;
}
Also used : BindValidationException(cn.taketoday.context.properties.bind.validation.BindValidationException) ObjectError(cn.taketoday.validation.ObjectError) BindException(cn.taketoday.context.properties.bind.BindException)

Example 2 with BindException

use of cn.taketoday.context.properties.bind.BindException in project today-infrastructure by TAKETODAY.

the class BindValidationFailureAnalyzer method getBindValidationExceptionDetails.

private ExceptionDetails getBindValidationExceptionDetails(Throwable rootFailure) {
    BindValidationException validationException = findCause(rootFailure, BindValidationException.class);
    if (validationException != null) {
        BindException target = findCause(rootFailure, BindException.class);
        List<ObjectError> errors = validationException.getValidationErrors().getAllErrors();
        return new ExceptionDetails(errors, target, validationException);
    }
    cn.taketoday.validation.BindException bindException = findCause(rootFailure, cn.taketoday.validation.BindException.class);
    if (bindException != null) {
        List<ObjectError> errors = bindException.getAllErrors();
        return new ExceptionDetails(errors, bindException.getTarget(), bindException);
    }
    return null;
}
Also used : BindValidationException(cn.taketoday.context.properties.bind.validation.BindValidationException) ObjectError(cn.taketoday.validation.ObjectError) BindException(cn.taketoday.context.properties.bind.BindException)

Aggregations

BindException (cn.taketoday.context.properties.bind.BindException)2 BindValidationException (cn.taketoday.context.properties.bind.validation.BindValidationException)2 ObjectError (cn.taketoday.validation.ObjectError)2