title: How to customize error response when deserializing failed
body: <p>I have a jaxrs endpoint service, in my own <code>ResourceConfig</code> I register an <code>ExceptionMapper</code>, so when somewhere wrong happened, it will return a JSON <code>{  errorEnum: "something" }</code>. The service class looks like this.</p>
  
  <pre><code>@POST
  @Path("/query")
  @Produces(MediaType.APPLICATION_JSON)
  @Consumes(MediaType.APPLICATION_JSON)
  public Response query(final QueryDefinition queryDefinition) {
      ...
  }
  </code></pre>
  
  <p>However, in my payload, there is a field which is Enum. If any user made a typo in that field, the error message will be</p>
  
  <pre><code>Can not deserialize value of type FIELD from String "AAA": value not
  one of declared Enum instance names: [AAA, BBB, CCC]  at [Source:
  org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@62ac814;
  line: 15, column: 17] (through reference chain:
  QueryDefinition["FIELD"])
  </code></pre>
  
  <p>I tried to use the customized EnumDeserializer, </p>
  
  <pre><code>public class EnumDeserializer extends JsonDeserializer&lt;Enum   {
      @Override
      public Dimensions deserialize(JsonParser jp, DeserializationContext deserializationContext) throws IOException,
  JsonProcessingException {
          JsonNode node = jp.getCodec().readTree(jp);
          String enumName = node.textValue();
          Enum e = Enums.fromString(enumName);
          if (e != null) { return e; }
          throw new CustomizedException("Not supported Enum");
      } }
  </code></pre>
  
  <p>But then the response becomes <code>Not supported Enum (through reference chain: QueryDefinition["FIELD"])</code>, which is still not what I want. </p>