|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoscript.util.ErrorHandler
The ErrorHandler
is used by the interpreter to handle
fatal, non-recoverable errors. When a fatal error occurs, the interpreter
calls fatalError(java.lang.String)
, which is expected not to return.
Currently, the only fatal error is a corrupt symbol table. See issue #246 for the juicy details.
A default ErrorHandler
is provided, which simply prints an
error message to stderr
and System.exit(int)
s. Sometimes,
such as in a GUI application where the user never sees stderr
,
you might want to implement your own error handler. There are two ways to
do this:
oscript.error.handler
property to the fully
qualified class name of a non-abstract class that extends
ErrorHandler
and has a no-arg constructor
setErrorHandler(oscript.util.ErrorHandler)
Constructor Summary | |
ErrorHandler()
|
Method Summary | |
static void |
fatalError(java.lang.String str)
Called in times of peril. |
static ErrorHandler |
getErrorHandler()
Get the fatal error handler. |
static void |
setErrorHandler(ErrorHandler handler)
Set the fatal error handler. |
abstract void |
showMessage(java.lang.String str)
Display an error message to the user. |
static void |
warning(java.lang.String str)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ErrorHandler()
Method Detail |
public static ErrorHandler getErrorHandler()
oscript.error.handler
property, and if that
fails reverting to the default fatal error handler.
public static void setErrorHandler(ErrorHandler handler)
public static void fatalError(java.lang.String str)
System.exit(int)
, or sit in an infinite loop. (It may be possible
to throw an exception, as long as care is taken to not throw anything
that may be caught by the interpreter. And if you do keep the VM
running, don't expect the ObjectScript interpreter to function.)
str
- a string describing the error, how the user may
correct the error, etcpublic static void warning(java.lang.String str)
str
- a string describing the error, how the user may
correct the error, etcpublic abstract void showMessage(java.lang.String str)
str
- a string describing the error, how the user may
correct the error, etc
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |