title: Issue with ExceptionMapper in Jersey
body: <p>I have two classes that implements <code>ExceptionMapper</code> interface.</p>
  <p><code>IllegalArgumentExceptionMapper</code> to handle <code>IllegalArgumentException</code>:</p>
  <pre class="lang-java prettyprint-override"><code>@Slf4j
  @Provider
  public class IllegalArgumentExceptionMapper implements ExceptionMapper&lt;IllegalArgumentException&gt; {
      @Override
      public Response toResponse(IllegalArgumentException exception) {
          log.info(&quot;IllegalArgumentExceptionMapper!&quot;);
          Error error =
                  Error.builder()
                          .statusCode(HttpStatus.SC_BAD_REQUEST)
                          .statusDescription(exception.getLocalizedMessage())
                          .errorMessage(exception.getMessage())
                          .build();
          return Response.status(Response.Status.BAD_REQUEST)
                  .entity(error)
                  .type(MediaType.APPLICATION_JSON)
                  .build();
      }
  }
  </code></pre>
  <p><code>GenericExceptionMapper</code> is an ExceptionMapper that I want to use as the default ExceptionMapper when an exception is not mapped to any of my other specific ExceptionMapper classes. Here it is:</p>
  <pre class="lang-java prettyprint-override"><code>@Slf4j
  @Provider
  public class GenericExceptionMapper implements ExceptionMapper&lt;Throwable&gt; {
  
      @Override
      public Response toResponse(Throwable ex) {
          log.info(&quot;GenericExceptionMapper!&quot;);
          Response.StatusType type = getStatusType(ex);
  
          Error error = Error.builder()
                  .statusCode(type.getStatusCode())
                  .statusDescription(type.getReasonPhrase())
                  .errorMessage(ex.getLocalizedMessage())
                  .build();
  
          return Response.status(error.getStatusCode())
                  .entity(error)
                  .type(MediaType.APPLICATION_JSON)
                  .build();
      }
  
      private Response.StatusType getStatusType(Throwable ex) {
          if (ex instanceof WebApplicationException) {
              return((WebApplicationException)ex).getResponse().getStatusInfo();
          } else {
              return Response.Status.INTERNAL_SERVER_ERROR;
          }
      }
  }
  </code></pre>
  <p>However, when I try to throw an <code>IllegalArgumentException</code>, with:</p>
  <pre class="lang-java prettyprint-override"><code>throw new IllegalArgumentException(&quot;Just a normal IllegalArgumentException!&quot;);
  </code></pre>
  <p>I see that <code>GenericExceptionMapper</code> instead of <code>IllegalArgumentExceptionMapper</code>  is being used.(I see &quot;GenericExceptionMapper!&quot; in the log).</p>
  <p>Any idea what went wrong?</p>
  <h4>Some observations</h4>
  <ol>
  <li>If I delete <code>GenericExceptionMapper</code>, <code>IllegalArgumentExceptionMapper</code> is still not being called. So I think there is an issue for my <code>IllegalArgumentExceptionMapper</code> implementation.</li>
  <li>If I modify <code>IllegalArgumentExceptionMapper</code> with <code>public class IllegalArgumentExceptionMapper implements ExceptionMapper&lt;RuntimeException&gt;</code> and <code>throw new RuntimeException</code>, then I see that <code>IllegalArgumentExceptionMapper</code> is being used.</li>
  </ol>