class DecodingExceptionMapper implements ExceptionMapper<DecodingException> {

    @Override
    public Response toResponse(final DecodingException exception) {
        LOGGER.warn("Failed to decode message: {}", exception.getMessage());
        LOGGER.debug(null, exception);

        return Response.status(Response.Status.BAD_REQUEST)
                .entity(exception.getMessage())
                .type(MediaType.TEXT_PLAIN)
                .build();
    }

}