CMSgov/dpc-app

View on GitHub
dpc-api/src/main/java/gov/cms/dpc/api/exceptions/JsonParseExceptionMapper.java

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
package gov.cms.dpc.api.exceptions;

import com.fasterxml.jackson.core.JsonParseException;

import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;

public class JsonParseExceptionMapper implements ExceptionMapper<JsonParseException> {
    @Override
    public Response toResponse(JsonParseException exception) {
        return Response.status(Response.Status.BAD_REQUEST).entity("Value could not be parsed as JSON").build();
    }
}