ec.gob.senescyt.sniese.commons.exceptions.mappers.InvalidFormatExceptionMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sniese-commons Show documentation
Show all versions of sniese-commons Show documentation
Librería que contiene clases de uso comun para sniese hechos en dropwizard
package ec.gob.senescyt.sniese.commons.exceptions.mappers;
import com.fasterxml.jackson.databind.exc.InvalidFormatException;
import ec.gob.senescyt.sniese.commons.core.Errores;
import ec.gob.senescyt.sniese.commons.core.MensajeError;
import org.eclipse.jetty.http.HttpStatus;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
public class InvalidFormatExceptionMapper implements ExceptionMapper{
@Override
public Response toResponse(InvalidFormatException exception) {
Errores errores = new Errores();
errores.agregar(new MensajeError("ErrorConversion", String.format("El dato en la columna [%s] es incorrecto", exception.getPathReference())));
return Response.status(HttpStatus.BAD_REQUEST_400).entity(errores).build();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy