Exception Class Reference

#include <Exception.hpp>

Collaboration diagram for Exception:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Exception (const std::string &rMessage, const std::string &rFilename, unsigned lineNumber)
std::string GetMessage () const
std::string GetShortMessage () const
std::string CheckShortMessage (std::string expected) const
std::string CheckShortMessageContains (std::string expected) const

Static Public Member Functions

static void Terminate (const std::string &rMessage, const std::string &rFilename, unsigned lineNumber)

Protected Member Functions

void SetMessage (const std::string &rMessage, const std::string &rFilename, unsigned lineNumber)

Private Attributes

std::string mMessage
std::string mShortMessage

Detailed Description

Exception class. All exceptions thrown by this code are currently instances of this class.

Definition at line 56 of file Exception.hpp.


Constructor & Destructor Documentation

Exception::Exception ( const std::string &  rMessage,
const std::string &  rFilename,
unsigned  lineNumber 
)

Construct an exception with a message string.

Parameters:
rMessage the message
rFilename which source file threw the exception
lineNumber which line number of the source file threw the exception

Definition at line 35 of file Exception.cpp.

References SetMessage().


Member Function Documentation

std::string Exception::CheckShortMessage ( std::string  expected  )  const

Helper method for checking we have the right exception.

Checks that mShortMessage matches that given, and returns a suitable error message string if not. If they do match, returns the empty string.

Parameters:
expected the expected value of mShortMessage

Definition at line 67 of file Exception.cpp.

References mShortMessage.

std::string Exception::CheckShortMessageContains ( std::string  expected  )  const

Helper method for checking we have the right exception.

Checks that mShortMessage contains the given string, and returns a suitable error message string if not. If it does, returns the empty string.

Parameters:
expected some expected substring of mShortMessage

Definition at line 77 of file Exception.cpp.

References mShortMessage.

Referenced by CardiacSimulation::ReadParametersFromFile().

std::string Exception::GetMessage (  )  const

Get the message associated with the exception with file and line number

Returns:
The message set when the exception was thrown including file and line number information

Definition at line 57 of file Exception.cpp.

References mMessage.

Referenced by AbstractConvergenceTester< CELL, CARDIAC_PROBLEM, DIM, PROBLEM_DIM >::Converge(), and CellMLToSharedLibraryConverter::ConvertCellmlToSo().

std::string Exception::GetShortMessage (  )  const

Get the message associated with the exception

Returns:
The message text set when the exception was thrown.

Definition at line 62 of file Exception.cpp.

References mShortMessage.

Referenced by PropagationPropertiesCalculator::CalculateAllActionPotentialDurationsForNodeRange(), and AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Initialise().

void Exception::SetMessage ( const std::string &  rMessage,
const std::string &  rFilename,
unsigned  lineNumber 
) [protected]

Allow subclasses to reset the exception message after construction of the base class, if desired.

Parameters:
rMessage the message
rFilename which source file threw the exception
lineNumber which line number of the source file threw the exception

Definition at line 48 of file Exception.cpp.

References mMessage, and mShortMessage.

Referenced by Exception().

void Exception::Terminate ( const std::string &  rMessage,
const std::string &  rFilename,
unsigned  lineNumber 
) [static]

Level 4 error (Termination). Execution cannot continue from this point and hence should be terminated (even when running with NDEBUG or in parallel).

Parameters:
rMessage An error message to appear on the screen
rFilename which source file produced the termination error
lineNumber which line number of the source file produced the termination error

Definition at line 88 of file Exception.cpp.


Member Data Documentation

std::string Exception::mMessage [private]

Full exception message - includes file and line number.

Definition at line 127 of file Exception.hpp.

Referenced by GetMessage(), and SetMessage().

std::string Exception::mShortMessage [private]

Short exception message - just text of the exception.

Definition at line 128 of file Exception.hpp.

Referenced by CheckShortMessage(), CheckShortMessageContains(), GetShortMessage(), and SetMessage().


The documentation for this class was generated from the following files:
Generated on Thu Dec 22 13:04:30 2011 for Chaste by  doxygen 1.6.3