ThePEG::Exception Class Reference

Exception is the base class for all exceptions to be used in ThePEG. More...

#include <Exception.h>

Inheritance diagram for ThePEG::Exception:

ThePEG::Decayer::DecayFailure ThePEG::MadGraphReader::WeightedExcetion ThePEG::RemnantDecayer::SubSystemFail ThePEG::SimpleBaryonRemnantDecayer::DecayFailed ThePEG::SimpleBaryonRemnantDecayer::NoDISRespect ThePEG::XSecCheck::UnexpectedXSec

List of all members.

Public Types

enum  Severity {
  unknown, info, warning, setuperror,
  eventerror, runerror, maybeabort, abortnow
}
 The levels of severity. More...

Public Member Functions

 Exception (const string &str, Severity sev)
 Standard constructor.
 Exception ()
 Default constructor.
 Exception (const Exception &ex)
 The copy constructor.
virtual ~Exception () throw ()
 The destructor.
const Exceptionoperator= (const Exception &ex)
 Assignment.
bool operator== (const Exception &ex) const
 Comparison.
bool operator< (const Exception &ex) const
 Compare severity.
virtual const char * what () const throw ()
 Return the error message.
string message () const
 Return the error message.
void writeMessage (ostream &os=*errstream) const
 Write the error message to a stream.
Severity severity () const
 Return the severity.
void handle () const
 Indicate that this exception has been taken care of.
template<typename T>
Exceptionoperator<< (const T &t)
 Add info to the exception message.
Exceptionoperator<< (Severity sev)
 Set the severity for the exception.

Protected Member Functions

void severity (Severity)
 set the severity.

Protected Attributes

ostringstream theMessage
 Stream to write the error message to.

Private Attributes

bool handled
 True if this exception has been taken care of.
Severity theSeverity
 The severity.

Static Private Attributes

static ostream * errstream
 The default stream to write the error message if unhandled.


Detailed Description

Exception is the base class for all exceptions to be used in ThePEG.

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 case 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:
Repository

EventGenrator

Definition at line 44 of file Exception.h.


Member Enumeration Documentation

The levels of severity.

Enumerator:
unknown  Unknown severity.
info  Not severe (but the user should be informed).

warning  Possibly severe, (the user should be warned).

setuperror  Command failed during setup phase, execution is continued.

eventerror  Possibly severe, (the event being generated should be discarded).

runerror  Severe error, (the run should be terminated).

maybeabort  Severe error, (the run should be terminated, possibly dumping core).

abortnow  Severe error, (the run is aborted immediately, before the exception is thrown).

Definition at line 51 of file Exception.h.


Constructor & Destructor Documentation

ThePEG::Exception::Exception ( const string &  str,
Severity  sev 
)

Standard constructor.

Parameters:
str an error message.
sev the severity.


Member Function Documentation

bool ThePEG::Exception::operator< ( const Exception ex  )  const [inline]

Compare severity.

If equal compare error message lexicographically.

Definition at line 123 of file Exception.h.

References message(), and severity().


The documentation for this class was generated from the following file:

Generated on Thu Apr 29 12:43:25 2010 for ThePEG by  doxygen 1.5.5