ptolemy.kernel.util
Interface ModelErrorHandler
- All Known Implementing Classes:
- BasicModelErrorHandler, FSMDirector, NamedObj
- public interface ModelErrorHandler
Interface for model error handlers. A model error is an exception that is
passed up the Ptolemy II hierarchy for handling until a container with
a registered error handler is found. If there is no registered error
handler, then the error is ignored. It is like throwing an exception, except
that instead of unraveling the calling stack, it travels up the Ptolemy II
hierarchy.
A typical use of this facility is where an actor does the following:
handleModelError(this, new IllegalActionException(this, message));
instead of this:
throw new IllegalActionException(this, message);
The former allows a container in the hierarchy to intercept the
exception, whereas the latter simply throws the exception.
- Since:
- Ptolemy II 2.1
- Version:
- $Id: ModelErrorHandler.java,v 1.11 2004/04/13 03:43:51 cxh Exp $
- Author:
- Edward A. Lee
- Accepted Rating:
- Proposed Rating:
handleModelError
public boolean handleModelError(NamedObj context,
IllegalActionException exception)
throws IllegalActionException
- Handle a model error.
- Parameters:
context - The object in which the error occurred.exception - An exception that represents the error.
- Returns:
- True if the error has been handled, or false if the
error is not handled.
- Throws:
IllegalActionException - If the handler handles the
error by throwing an exception.