|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Throwable java.lang.Exception jess.JessException
This is the base class of all exceptions thrown by any functions in the Jess library. JessException is rather complex, as exception classes go. An instance of this class can contain a wealth of information about an error that occurred in Jess. Besides the typical error message, a JessException may be able to tell you the name of the routine in which the error occurred, the name of the Jess constructs that were on the exceution stack, the relevant text and line number of the executing Jess language program, and the Java exception that triggered the error (if any.)
One of the most important pieces of advice for working with the Jess library is that in your catch clauses for JessException, display the exception object. Print it to System.out, or convert to a String and display it in a dialog box, or log it, or something. The exceptions are there to help you by telling when something goes wrong; please don't ignore them.
Another important tip: the JessException class has a method
getCause()
which returns non-null when a particular
JessException is a wrapper for another kind of exception. For
example, if your Jess code calls a Java
function that throws an exception, then the Jess code will throw
a JessException, and calling getCause()
will
return the real exception that was thrown. Your JessException
handlers should always check getCause; if your handler
simply displays a thrown exception, then it should display the
return value of getCause, too.
Field Summary | |
static int |
CLASS_NOT_FOUND
|
static int |
GENERAL_ERROR
|
static int |
NO_ERROR
|
Constructor Summary | |
JessException(java.lang.String routine,
java.lang.String msg,
int data)
Constructs a JessException containing a descriptive message. |
|
JessException(java.lang.String routine,
java.lang.String msg,
java.lang.String data)
Constructs a JessException containing a descriptive message. |
|
JessException(java.lang.String routine,
java.lang.String msg,
java.lang.Throwable t)
Constructs a JessException containing a nested exception. |
Method Summary | |
java.lang.Throwable |
getCause()
Get any nested exception object. |
java.lang.String |
getContext()
Get the context information for this error. |
java.lang.String |
getData()
Get the extra error data. |
java.lang.String |
getDetail()
Get the error message. |
int |
getErrorCode()
Returns one of the error codes in class ParseException . |
int |
getLineNumber()
Get the program line number where the error occurred. |
java.lang.String |
getProgramText()
Get the Jess program fragment that led to this exception |
java.lang.String |
getRoutine()
Get the Java routine name where this error occurred |
void |
setErrorCode(int code)
Set the error code for this exception. |
java.lang.String |
toString()
Returns a String representation of this JessException. |
Methods inherited from class java.lang.Throwable |
fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int NO_ERROR
public static final int GENERAL_ERROR
public static final int CLASS_NOT_FOUND
Constructor Detail |
public JessException(java.lang.String routine, java.lang.String msg, java.lang.String data)
routine
- the name of the routine this exception occurred in.msg
- an informational message.data
- usually some data; appended to msg after a space.public JessException(java.lang.String routine, java.lang.String msg, int data)
routine
- the name of the routine this exception occurred in.msg
- an informational message.data
- usually some data; appended to msg after a space.public JessException(java.lang.String routine, java.lang.String msg, java.lang.Throwable t)
routine
- the name of the routine this exception occurred in.msg
- an informational message.t
- another type of exception that this object wrapsMethod Detail |
public java.lang.Throwable getCause()
public int getLineNumber()
public java.lang.String getDetail()
public java.lang.String getRoutine()
public java.lang.String getData()
public java.lang.String getProgramText()
public java.lang.String getContext()
public java.lang.String toString()
public int getErrorCode()
ParseException
.
public void setErrorCode(int code)
ParseException
.
code
- the desired error code
|
© 2007 Sandia Corporation | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |