Class PrintExceptions

  • All Implemented Interfaces:
    EventHandler, MethodExceptionEventHandler, RuntimeServicesAware

    public class PrintExceptions
    extends java.lang.Object
    implements MethodExceptionEventHandler, RuntimeServicesAware
    Simple event handler that renders method exceptions in the page rather than throwing the exception. Useful for debugging.

    By default this event handler renders the exception name only. To include both the exception name and the message, set the property eventhandler.methodexception.message to true. To render the stack trace, set the property eventhandler.methodexception.stacktrace to true.

    Since:
    1.5
    Version:
    $Id: PrintExceptions.java 685685 2008-08-13 21:43:27Z nbubna $
    • Field Detail

      • SHOW_MESSAGE

        private static java.lang.String SHOW_MESSAGE
      • SHOW_STACK_TRACE

        private static java.lang.String SHOW_STACK_TRACE
    • Constructor Detail

      • PrintExceptions

        public PrintExceptions()
    • Method Detail

      • methodException

        public java.lang.Object methodException​(java.lang.Class claz,
                                                java.lang.String method,
                                                java.lang.Exception e)
                                         throws java.lang.Exception
        Render the method exception, and optionally the exception message and stack trace.
        Specified by:
        methodException in interface MethodExceptionEventHandler
        Parameters:
        claz - the class of the object the method is being applied to
        method - the method
        e - the thrown exception
        Returns:
        an object to insert in the page
        Throws:
        java.lang.Exception - an exception to be thrown instead inserting an object
      • getStackTrace

        private static java.lang.String getStackTrace​(java.lang.Throwable throwable)