Boost logo

Boost :

From: Aaron W. LaFramboise (aaronrabiddog51_at_[hidden])
Date: 2005-03-12 19:50:12

Most of the time when a library routine encounters an error, that error
is fatal, and the proper course of action is fairly obvious: throw an
exception, return a singular value, or similar.

However, in some cases, we encounter errors that are non-fatal, and
simply giving up is not the most appropriate course of action. The
error encountered may be inconsequential to successful completion, or we
may have gotten notification of the error too late for it to make a
difference, or design considerations may prevent us from terminating. A
common example is encountering an unrecoverable error in a destructor
while closing a file.

These errors must be reported. However, without making special
provisions for doing so, its unclear exactly how to report them. As
we're in code for generic libraries, suggestions such as printing to
std::cerr are clearly unacceptable. We also want to avoid encumbering
the library interface with error-handling clutter that may never be used.

How should Boost libraries be designed so as to allow these errors to be
reported? Do existing Boost libraries have problems with these
situations, and if so, how have they solved it?

Aaron W. LaFramboise

Boost list run by bdawes at, gregod at, cpdaniel at, john at