public class PrintExceptions extends Object implements MethodExceptionEventHandler, RuntimeServicesAware
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
.
MethodExceptionEventHandler.MethodExceptionExecutor
Constructor and Description |
---|
PrintExceptions() |
Modifier and Type | Method and Description |
---|---|
Object |
methodException(Class claz,
String method,
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.
|
public Object methodException(Class claz, String method, Exception e) throws Exception
methodException
in interface MethodExceptionEventHandler
claz
- the class of the object the method is being applied tomethod
- the methode
- the thrown exceptionException
- an exception to be thrown instead inserting an objectpublic void setRuntimeServices(RuntimeServices rs)
RuntimeServicesAware
setRuntimeServices
in interface RuntimeServicesAware
rs
- RuntimeServices object assigned during initializationRuntimeServicesAware.setRuntimeServices(org.apache.velocity.runtime.RuntimeServices)
Copyright © 2000–2021. All rights reserved.