ec.gob.senescyt.sniese.commons.exceptions.mappers.JsonMappingExceptionMapper 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.JsonMappingException;
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 JsonMappingExceptionMapper implements ExceptionMapper{
@Override
public Response toResponse(JsonMappingException exception) {
Errores errores = new Errores();
errores.agregar(new MensajeError("ErrorFormato",String.format("Formato inválido [%s]",exception.getPathReference())));
return Response.status(HttpStatus.BAD_REQUEST_400).entity(errores).build();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy