ExceptionMapper Error in RESTEasy

In my JAXRS app, I have 2 ExceptionMapperregistered as@Provider

public class MyExceptionMapper implements ExceptionMapper<Exception> {...}

public class MyCustomRuntimeExceptionMapper implements ExceptionMapper<MyCustomRuntimeException> {...}

When my application throws a new one MyCustomRuntimeException, the exception gets inside MyExceptionMapper, although (says JAX-RS spec) it should be caught inside MyCustomRuntimeExceptionMapper.

Here is what JAXRS says -

JAX-RS also supports inheritance inheritance. When an exception occurs, JAX-RS will first try to find the ExceptionMapper for this type of exception. If he cannot find it, he will look for a map that can handle the superclass of the exception class. This will continue until there are no more superclasses to match.

Does anyone know what is going on here?

+3
2

, , , web.xml:

<context-param>
        <param-name>resteasy.providers</param-name>
        <param-value>CustomExceptionHandler,DefaultExceptionHandler</param-value>
</context-param>
+1

. , , . ExceptionMapper . , , ; . , "if (e instanceof SubClassA)".

0

Source: https://habr.com/ru/post/1752379/


All Articles