code: @Override
      public Response toResponse(WebApplicationException exception) {
          return Response.status(STATUS_IM_A_TEAPOT)
                  .entity(new JsonObject()
                          .put("msg", exception.getMessage())
                          .put("type", exception.getClass().getName())
                          .encode())
                  .type(MediaType.APPLICATION_JSON_TYPE)
                  .build();
      }
docs: Map an exception to a {@link Response}. Returning
  {@code null} results in a {@link Response.Status#NO_CONTENT}
  response. Throwing a runtime exception results in a
  {@link Response.Status#INTERNAL_SERVER_ERROR} response.
  
  @param exception the exception to map to a response.
  @return a response mapped from the supplied exception.