All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ec.gob.senescyt.sniese.commons.exceptions.mappers.InvalidFormatExceptionMapper Maven / Gradle / Ivy

There is a newer version: 2.0.5
Show newest version
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