ZOOM Exceptions: Goals and Intentions
ZOOM
ZOOM
ZMx
Exception Mechanism: Goals and Intentions
Intentions
The Zoom exception mechanism is intended to be the tools used by ZOOM modules
to handle exceptions in a useful way and provide the user with interfaces to
control how to react to problems.
It may also fill the need for a
mechanism for the user to hook into to define and ZMthrow exceptions specific
to the user code.
ZOOM needed to implement the mechanism early, to avoid delivering
packages which would have to be re-instrumented when the exception
mechanism was is finally adopted.
This is not a "signal handler" mechanism, which could be used to establish
behavior for segment violations, arithmetic exceptions, and so forth. It
would be nice to have this but C++ does not provide generic support for
those activities. A later possibility will be to provide this
support for POSIX-compliant operating systems, and coordinate it with the
exception mechanism.
Assumptions
The conception is that for a large HEP code, many users will contribute
segments, which fit into some overall framework.
The framework writer(s)
may be expected to pay more attention to specialized software details, and
set things up to
free other users to focus on expressing their physics and algorithms.
We need to be able to cope with the following realities:
-
Users will not, in every case, imbed calls into a
try
block.
-
Frameworks will incorporate code from multiple users and in some
circumstances cannot afford to abort the entire job if some rare path
in one user's code blows up (by not
catch
ing
an exception caused by a probelmatic use of some utility).
To the extent we can help with this, we must.
-
Framework creators can be expected to take actions to prevent
accidental aborting of the overall program. At the simplest level
this might mean imbedding
portions of the framework into
try
blocks.
Assuming we give them the necessary tools, the framework can
set up appropriate behaviors for various exceptions in a more flexible way.
-
There is need for coordinated logging of exception-related incidents.
The experiments might or might not have adopted a particular logging scheme;
the ZOOM mechanism has to provide a sensible scheme as well as optional
hooks to route the information to the experiment's mechanism.
Goals
In light of those assumptions, the mechanism must meet the following goals:
- The user (probably the framework writer) should be able to specify,
for a given sort of exception, whether
she wants to:
-
throw
the exception via the C++ mechanism,
thus aborting unless the framework or a the responsible lower-level
user catch
es the problem.
-
Invoke a user-written handler when the exception occurs, which may
itself determine it is necessary to
throw
the exception.
-
Ignore the exception returning to the spot in the ZOOM module
that detected the problem.
This can happen with or without a handler
being invoked. Typically, the module will then return some approriate
pseudo-value to the user -- e.g., some routines return
false
if the requested action could not
be accomplished.
-
In cases where exceptions are to be handled or ignored, there should be
a well-known way to get information about the existance of a problem,
analogous to the
errno
mechanism in C on Unix systems.
- As in the
errno
mechanism, the user can "clear"
the latest exception, so as to be able to check after a segment of code
whether any new problems have occured.
- Instead of just the one latest exception, a history buffer of the last
N exceptions will be kept.
-
Explanatory strings should be associated with the problem at the point
of origin. These, along with information about the type of exception,
the originator, and the module being used, should be incorporated into a
log message for each exception.
-
Exceptions should carry associated severity levels, in the familiar manner:
Info, Warning, Error, Severe, Fatal.
-
The exceptions are organized in a hierarchical manner, which uniformly
applies one simple category philosophy that the users can understand,
across the various ZOOM packages.
Finally, since the exception mechanism needs an associated logging
mechanism, we provide that mechanism to the user for non-exception use
as well.

ZOOM Exceptions -
ZOOM Home Page -
Fermilab at Work -
Fermilab Home
Mark Fischler
and Philippe Canal
Last modified: August 13, 1997