Interface ExceptionMapper

    • Method Detail

      • sqlExceptionMapper

        static ExceptionMapper sqlExceptionMapper()
        Exception wrapper, that may be used to copy error code and sql state to the WrappedException message.

        This mapper will only works correctly if the module java.sql is available.

        Returns:
        the Mapper for SQLException.
        Throws:
        NoClassDefFoundError - In case the SQLException is not available (java.sql module missing).
      • jaxbExceptionMapper

        static ExceptionMapper jaxbExceptionMapper()
        Exception wrapper, that may be used to copy jaxb information to the WrappedException message.

        This mapper will only works correctly if the class JAXBException is available.

        Returns:
        the Mapper for JAXBException.
        Throws:
        NoClassDefFoundError - In case the JAXBException is not available.
        Since:
        2.1.0
      • saxExceptionMapper

        static ExceptionMapper saxExceptionMapper()
        Exception wrapper, that may be used to copy sax information to the WrappedException message.

        This mapper will only works correctly if the class SAXException is available.

        Returns:
        the Mapper for SAXException.
        Throws:
        NoClassDefFoundError - In case the SAXException is not available (java.xml module missing).
        Since:
        2.1.0
      • transformerExceptionMapper

        static ExceptionMapper transformerExceptionMapper()
        Exception wrapper, that may be used to copy transformer exception information to the WrappedException message.

        This mapper will only works correctly if the class SAXException is available.

        Returns:
        the Mapper for TransformerException.
        Throws:
        NoClassDefFoundError - In case the TransformerException is not available (java.xml module missing).
        Since:
        2.1.0
      • order

        default int order()
        This method is used when ExceptionMapper are registered as default Mapper to defines the right order to select then.
        Returns:
        an ordering key, by default 0.
        Since:
        2.2.0
      • forException

        static <E extends ExceptionExceptionMapper forException​(Class<E> clazz,
                                                                  Function<E,RuntimeException> mapper)
        Helper method to create exception wrapper that check the exception class.
        Type Parameters:
        E - the type of the exception.
        Parameters:
        clazz - the class of the exception to be wrapped.
        mapper - the exception mapper.
        Returns:
        A new exception mapper, which use the one received as parameter or for the other exception just create a WrappedException.
      • forException

        static <E extends ExceptionExceptionMapper forException​(Class<E> clazz,
                                                                  Function<E,RuntimeException> mapper,
                                                                  int order)
        Helper method to create exception wrapper that check the exception class.
        Type Parameters:
        E - the type of the exception.
        Parameters:
        clazz - the class of the exception to be wrapped.
        mapper - the exception mapper.
        order - the order
        Returns:
        A new exception mapper, which use the one received as parameter or for the other exception just create a WrappedException.
        Since:
        2.2.0