Annotation Interface ClientExceptionMapper


@Retention(RUNTIME) @Target(METHOD) public @interface ClientExceptionMapper
Used to easily define an exception mapper for the specific REST Client on which it's used. This method is called when the HTTP response from the invoked service has a status code of 400 or higher.

The annotation MUST be placed on a method of the REST Client interface that meets the following criteria:

The method can utilize any combination of the following parameters:
  • jakarta.ws.rs.core.Response which represents the HTTP response
  • Method which represents the invoked method of the client
  • URI which represents the the request URI
  • Map<String, Object> which gives access to the properties that are available to (and potentially changed by) ClientRequestContext
  • jakarta.ws.rs.core.MultivaluedMap containing the request headers
An example method could look like the following:
 
 @ClientExceptionMapper
 static DummyException map(Response response, Method method) {
     if (response.getStatus() == 404) {
         return new DummyException();
     }
     return null;
 }

 
 
If null is returned, Quarkus will continue searching for matching ResponseExceptionMapper.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    int
    The priority with which the exception mapper will be executed.
  • Element Details

    • priority

      int priority
      The priority with which the exception mapper will be executed.

      They are sorted in ascending order; the lower the number the higher the priority.

      See Also:
      • Priorities
      Default:
      5000