ZOOM Exceptions: Goals and Intentions
Exception Mechanism: Goals and 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
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
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
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
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.
In light of those assumptions, the mechanism must meet the following goals:
Finally, since the exception mechanism needs an associated logging
mechanism, we provide that mechanism to the user for non-exception use
- 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
catches the problem.
Invoke a user-written handler when the exception occurs, which may
itself determine it is necessary to
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
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.
ZOOM Exceptions -
ZOOM Home Page -
Fermilab at Work -
and Philippe Canal
Last modified: August 13, 1997