Search in sources :

Example 1 with ValidationException

use of com.emc.vipr.client.exceptions.ValidationException in project coprhd-controller by CoprHD.

the class ValidationErrorFilter method handle.

@Override
public ClientResponse handle(ClientRequest request) throws ClientHandlerException {
    ClientResponse response = getNext().handle(request);
    int status = response.getStatus();
    if (supportsPortalValidation(request) && status == 400) {
        List<ValidationError> errorsList = ApiListUtils.getEntityList(config, new GenericType<List<ValidationError>>() {
        }, response);
        ValidationException exception = new ValidationException(response.getStatus(), errorsList);
        LOG.error(exception.getMessage());
        throw exception;
    }
    return response;
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) ValidationException(com.emc.vipr.client.exceptions.ValidationException) List(java.util.List) ValidationError(com.emc.vipr.model.catalog.ValidationError)

Aggregations

ValidationException (com.emc.vipr.client.exceptions.ValidationException)1 ValidationError (com.emc.vipr.model.catalog.ValidationError)1 ClientResponse (com.sun.jersey.api.client.ClientResponse)1 List (java.util.List)1