public class PrintExceptions extends Object implements MethodExceptionEventHandler, RuntimeServicesAware
By default this event handler renders an error message containing the class and method which generated
the exception, the exception name and its message.
To render the reference and the location in the template, set the property eventhandler.methodexception.templateinfo
to true
.
To render the stack trace, set the property eventhandler.methodexception.stacktrace
to true
.
Constructor and Description |
---|
PrintExceptions() |
Modifier and Type | Method and Description |
---|---|
Object |
methodException(Context context,
Class claz,
String method,
Exception e,
Info info)
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(Context context, Class claz, String method, Exception e, Info info)
methodException
in interface MethodExceptionEventHandler
context
- current contextclaz
- the class of the object the method is being applied tomethod
- the methode
- the thrown exceptioninfo
- template name and line, column informationspublic void setRuntimeServices(RuntimeServices rs)
RuntimeServicesAware
setRuntimeServices
in interface RuntimeServicesAware
rs
- RuntimeServices object assigned during initializationRuntimeServicesAware.setRuntimeServices(org.apache.velocity.runtime.RuntimeServices)
Copyright © 2000–2019 The Apache Software Foundation. All rights reserved.