You can instantiate an EveException
in one
of three ways:
EveException(String
fromClass,String fromMethod,Exception e)
EveException(String
fromClass,String fromMethod,String message,Exception e)
EveException(String
fromClass,String fromMethod,String message)
EveExceptions are designed primarily for logging purposes.
For example, if you instantiate an EveException with an exception, it
will create a stack trace, log it to disk, and return. The fromMethod
and fromClass
features are used to designate the method in
the code that triggered the exception.
NOTE ยท Do not forget to enable error logging. Refer to the error logging section of the eve.properties File for more information on enabling error logging.
The following code catches a Java exception, creates a new EveException to wrap it, and throws the new EveException:
Public
void myMethod( myMethodOptions )
{
try
{
// Something that could blow up
}
catch (Exception exception)
{
throw new EveException( "myClass", "myMethod",
"your
very own error message",
exception);
}
}
EveException.stackTrace
(a string variable) contains a formatted stack trace. This stack trace
is exactly the trace that is logged, with timestamp, to the error log
directory specified in the Eve.properties
file.