CMS 3D CMS Logo

lat::Error Class Reference

An exception base class. More...

#include <Iguana/Utilities/classlib/utils/Error.h>

Inheritance diagram for lat::Error:

IgNetError IgPluginError IgPluginParserError lat::AutoLoadError lat::BZError lat::CPIOError lat::FilenameError lat::IOError lat::IOException lat::RegexpError lat::SHA1Error lat::SharedLibraryError lat::SubProcessError lat::SystemError lat::TarError lat::UUIDError lat::ZError

List of all members.

Public Member Functions

virtual Errorclone (void) const =0
 Make a deep copy of this exception chain.
 Error (const Error &x)
 Error (Error *chain=0)
virtual std::string explain (int depth=-1) const
virtual std::string explainSelf (void) const =0
 Explain this exception object.
Errornext (void) const
 Get the next error in the chain.
Erroroperator= (const Error &x)
virtual void rethrow (void)=0
 Rethrow the error to discover its real dynamic type.
virtual ~Error (void)

Private Attributes

Errorm_chain


Detailed Description

An exception base class.

This class provides a base for application run-time errors. It supports designs important for robust exception handling: not losing information, abstracting the error as it propagates up in the application, and being able to re-explain the errors when dealing with them.

The first two design issues are covered by allocating exceptions and chaining them together. An error object is first constructed with constructor and thrown by value from deep in the call tree. As the object is caught and dealt with in the caller layers, they can build up a more abstract explanation of the error by creating another error object chained to a clone of the original one. Consider for an example an application failing to save a file because it runs out of disk space. The I/O write routine will throw a system error object describing the out-of-space condition. The file save code will catch the error and throw a new ``save failure'' object chained to the I/O error object. This continues up in the application until it gets to the level where the error can be finally dealt with and presented to the user.

Once the exception is dealt with, it is necessary to find out what caused the problem. This class supports two ways of doing so: getting a description as a message that can be presented to the user, or exploring the exception chain.

Every error object can provide a description of the whole problem chain through the explain() method. The resulting string will provide an explanation that cascades through the whole chain of errors: "The file could not be saved because disk was full".

The error objects can also be explored by the application. Typically the higher levels will catch errors by the base class reference("Error &"). To rediscover the source of the exception, the error object can be re-thrown and caught by its specific type to find its actual type (rethrow()). This allows the application to recovery without consulting the user. For example, in our save scenario the application might be able to remove some dispensable temporary files and the retry saving before giving up and asking the user what to do.

The basic motivation of this design is to avoid pushing user interface knowledge deep into the application. Instead errors can be recovered where it make sense, and libraries without any knowledge of the user interface can be used as is.

Note that this class does not inherit from the standard library's exception classes because of the somewhat incompatible design goals and because those classes have rather annoying exception specs on many of their methods. This class does away with the specs but still requires them to be honoured: no error object method except rethrow should ever throw.

Definition at line 71 of file Error.h.


Constructor & Destructor Documentation

lat::Error::Error ( Error chain = 0  ) 

lat::Error::Error ( const Error x  ) 

virtual lat::Error::~Error ( void   )  [virtual]


Member Function Documentation

virtual Error* lat::Error::clone ( void   )  const [pure virtual]

Make a deep copy of this exception chain.

Implemented in IgNetError, IgPluginError, IgPluginParserError, lat::FileError, lat::FileMappingError, lat::FilenameError, lat::FileSystemError, lat::IOError, lat::NetworkError, lat::SubProcessError, lat::IOException, lat::StdError, lat::StdioError, lat::AutoLoadError, lat::RegexpError, lat::SharedLibraryError, lat::SystemError, lat::UUIDError, lat::BZError, lat::CPIOError, lat::SHA1Error, lat::TarError, and lat::ZError.

Referenced by IgModule::checkEntryPoints(), IgModule::library(), and IgNet::startLocalServer().

virtual std::string lat::Error::explain ( int  depth = -1  )  const [virtual]

Referenced by DQMService::DQMService(), DQMStore::getMatchingContents(), IgPluginManager::initialise(), IgApplication::loadDriver(), IgNet::losePeer(), DQMNet::losePeer(), VisNet::losePeer(), VisNet::onLocalNotify(), IgNet::onLocalNotify(), DQMNet::onLocalNotify(), IgLibraryPreloader::operator()(), IgModuleCache::parse(), IgApplication::pluginFeedback(), VisNet::run(), IgNet::run(), DQMNet::run(), IgModuleCache::scanModules(), DQMNet::startLocalServer(), VisNet::startLocalServer(), IgNet::startLocalServer(), IgApplication::startMemStats(), and IgApplication::startProfiler().

virtual std::string lat::Error::explainSelf ( void   )  const [pure virtual]

Explain this exception object.

Implemented in IgNetError, IgPluginError, IgPluginParserError, lat::FileError, lat::FileMappingError, lat::FilenameError, lat::FileSystemError, lat::IOError, lat::NetworkError, lat::SubProcessError, lat::IOException, lat::StdError, lat::StdioError, lat::AutoLoadError, lat::RegexpError, lat::SharedLibraryError, lat::SystemError, lat::UUIDError, lat::BZError, lat::CPIOError, lat::SHA1Error, lat::TarError, and lat::ZError.

Referenced by VisEventMenu::autoEvents(), VisEventMenu::autoPrint(), VisConfiguration::dumpConfig(), VisExceptionService::errorCallback(), VisMainProgram::frameworkExceptionCallback(), VisEventMenu::initEventProcessor(), VisEventMenu::nextEvent(), edm::service::IguanaService::postEndJob(), edm::service::IguanaService::preEventProcessing(), VisEventMenu::previousEvent(), VisEventMenu::reInitEventProcessor(), and VisEventMenu::skipEvent().

Error * lat::Error::next ( void   )  const [inline]

Get the next error in the chain.

Definition at line 101 of file Error.h.

References m_chain.

Referenced by VisNet::onLocalNotify(), IgNet::onLocalNotify(), DQMNet::onLocalNotify(), VisNet::onPeerData(), DQMNet::onPeerData(), IgNet::onPeerData(), VisNet::run(), IgNet::run(), and DQMNet::run().

00102 { return m_chain; }

Error& lat::Error::operator= ( const Error x  ) 

virtual void lat::Error::rethrow ( void   )  [pure virtual]

Rethrow the error to discover its real dynamic type.

Implemented in IgNetError, IgPluginError, IgPluginParserError, lat::FileError, lat::FileMappingError, lat::FilenameError, lat::FileSystemError, lat::IOError, lat::NetworkError, lat::SubProcessError, lat::IOException, lat::StdError, lat::StdioError, lat::AutoLoadError, lat::RegexpError, lat::SharedLibraryError, lat::SystemError, lat::UUIDError, lat::BZError, lat::CPIOError, lat::SHA1Error, lat::TarError, and lat::ZError.


Member Data Documentation

Error* lat::Error::m_chain [private]

Definition at line 93 of file Error.h.

Referenced by next().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:48:24 2009 for CMSSW by  doxygen 1.5.4