| java.lang.Object oscript.util.ErrorHandler
All known Subclasses: oscript.util.SwingErrorHandler,
ErrorHandler | abstract public class ErrorHandler (Code) | | The ErrorHandler is used by the interpreter to handle
fatal, non-recoverable errors. When a fatal error occurs, the interpreter
calls
ErrorHandler.fatalError , 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 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:
- Set the
oscript.error.handler property to the fully
qualified class name of a non-abstract class that extends
ErrorHandler and has a no-arg constructor
- Programatically by calling
ErrorHandler.setErrorHandler
author: Rob Clark (rob@ti.com) version: 1 |
fatalError | public static void fatalError(String str)(Code) | | Called in times of peril. This method should definately not return
normally, and probably shouldn't return at all, ie. it should call
System.exit , 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.)
Parameters: str - a string describing the error, how the user maycorrect the error, etc |
getErrorHandler | public static ErrorHandler getErrorHandler()(Code) | | Get the fatal error handler. If it has not yet been set/loaded, this
will cause it to be loaded by first trying to load the class specified
by the oscript.error.handler property, and if that
fails reverting to the default fatal error handler.
|
setErrorHandler | public static void setErrorHandler(ErrorHandler handler)(Code) | | Set the fatal error handler.
|
showMessage | abstract public void showMessage(String str)(Code) | | Display an error message to the user.
Parameters: str - a string describing the error, how the user maycorrect the error, etc |
warning | public static void warning(String str)(Code) | | Parameters: str - a string describing the error, how the user maycorrect the error, etc |
|
|