Annotation Interface ServerExceptionMapper


@Retention(RUNTIME) @Target(METHOD) public @interface ServerExceptionMapper
When used on a method, then an implementation of ExceptionMapper is generated that calls the annotated method with the proper arguments.

When the annotation is placed on a method that is not a JAX-RS Resource class, the method handles exceptions in global fashion (as do regular JAX-RS ExceptionMapper implementations). However, when it is placed on a method of a JAX-RS Resource class, the method is only used to handle exceptions originating from that JAX-RS Resource class. Methods in a JAX-RS class annotated with this annotation will be used first when determining how to handle a thrown exception. This means that these methods take precedence over the global ExceptionMapper classes.

In addition to the exception being handled, an annotated method can also declare any of the following parameters (in any order):

When value is not set, then the handled Exception type is deduced by the Exception type used in the method parameters (there must be exactly one Exception type in this case).

The return type of the method must be either be of type Response, Uni<Response>, RestResponse or Uni<RestResponse>.

See also UnwrapException

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    int
    The priority with which the exception mapper will be executed
    Class<? extends Throwable>[]
     
  • Element Details

    • value

      Class<? extends Throwable>[] value
      Default:
      {}
    • priority

      int priority
      The priority with which the exception mapper will be executed
      Default:
      5000