Class PrintExceptions
- java.lang.Object
-
- org.apache.velocity.app.event.implement.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
totrue
. To render the stack trace, set the propertyeventhandler.methodexception.stacktrace
totrue
.- Since:
- 1.5
- Version:
- $Id: PrintExceptions.java 685685 2008-08-13 21:43:27Z nbubna $
- Author:
- Will Glass-Husain
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.velocity.app.event.MethodExceptionEventHandler
MethodExceptionEventHandler.MethodExceptionExecutor
-
-
Constructor Summary
Constructors Constructor Description PrintExceptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
methodException(java.lang.Class claz, java.lang.String method, java.lang.Exception e)
Render the method exception, and optionally the exception message and stack trace.void
setRuntimeServices(RuntimeServices rs)
Called automatically when event cartridge is initialized.
-
-
-
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 interfaceMethodExceptionEventHandler
- Parameters:
claz
- the class of the object the method is being applied tomethod
- the methode
- the thrown exception- Returns:
- an object to insert in the page
- Throws:
java.lang.Exception
- an exception to be thrown instead inserting an object
-
setRuntimeServices
public void setRuntimeServices(RuntimeServices rs)
Description copied from interface:RuntimeServicesAware
Called automatically when event cartridge is initialized.- Specified by:
setRuntimeServices
in interfaceRuntimeServicesAware
- Parameters:
rs
- RuntimeServices object assigned during initialization- See Also:
RuntimeServicesAware.setRuntimeServices(org.apache.velocity.runtime.RuntimeServices)
-
-