File: Exception.h
Description:
Exception is the base class for all exceptions to be
used in Pythia7. It is derived from std::exception and
adds information about the severity of the exception to indicate to
the Repository and EventGenrator
how to act on it.
To throw an exception one should inherit from Exception
and add information in the constructor of the base
class. Alternatively one can use the operator<<
operator on a default constructed Exception to add
information as for a standard ostream object, in which
cas one should always end with adding an enum of the type
Exception::Severity to indicate the severity of the
exception e.g. Exception() << "Something went wrong." <<
Exception::eventerror.
See
also:
namespace Pythia7
CLASS
Exception:
Base class:
Public members:
enum Severity {unknown, info, warning, eventerror, runerror, maybeabort,
abortnow };
The levels of severity.
Exception(const string &, Severity);
Standard constructor.
inline Exception();
inline Exception(const Exception &);
virtual ~Exception() throw();
Default ctors and dtor.
inline const Exception & operator=(const Exception &);
inline bool operator==(const Exception &) const;
inline bool operator<(const Exception &) const;
Assignment and comparisons.
inline virtual const char* what () const throw();
inline string message() const;
void writeMessage(ostream & os = *errstream) const;
Return the error message or write it to a stream.
inline Severity severity() const;
Return the severity.
inline void handle() const;
Indicate that this exception has been taken care of.
template <typename T>
inline Exception & operator<<(const T & t);
Add info to the exception message.
inline Exception & operator<<(Severity sev);
Set the severity for the exception.
Protected members:
void severity(Severity);
set the severity.
mutable ostringstream theMessage;
Stream to write the error message to.
Private members:
mutable bool handled;
True if this exception has been taken care of.
Severity theSeverity;
The severity.
static ostream * errstream;
The default stream to write the error message if unhandled.
EXTERNAL DECLARATIONS
DEFINED MACROS
INCLUDED FILES
exception
Pythia7/Config/Pythia7.h
Exception.fh
string
Pythia7/Utilities/sstream.h
iosfwd
Exception.icc