Cantera  2.1.2
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
CanteraError Class Reference

Base class for exceptions thrown by Cantera classes. More...

#include <ctexceptions.h>

Inheritance diagram for CanteraError:
[legend]

Public Member Functions

 CanteraError (const std::string &procedure, const std::string &msg)
 Normal Constructor for the CanteraError base class. More...
 
virtual ~CanteraError () throw ()
 Destructor for base class does nothing. More...
 
const char * what () const throw ()
 Get a description of the error. More...
 
void save ()
 Function to put this error onto Cantera's error stack. More...
 
virtual std::string getMessage () const
 Method overridden by derived classes to formatted the error message. More...
 
virtual std::string getClass () const
 Method overridden by derived classes to indicate their type. More...
 

Protected Member Functions

 CanteraError ()
 Protected default constructor discourages throwing errors containing no information. More...
 
 CanteraError (const std::string &procedure)
 Constructor used by derived classes that override getMessage() More...
 

Protected Attributes

std::string procedure_
 The name of the procedure where the exception occurred. More...
 

Private Attributes

std::string msg_
 Message associated with the exception. More...
 
std::string formattedMessage_
 Formatted message returned by what() More...
 
bool saved_
 Exception has already been saved to Cantera's error stack. More...
 

Detailed Description

Base class for exceptions thrown by Cantera classes.

This class is the base class for exceptions thrown by Cantera. It inherits from std::exception so that normal error handling operations from applications may automatically handle the errors in their own way.

Definition at line 68 of file ctexceptions.h.

Constructor & Destructor Documentation

CanteraError ( const std::string &  procedure,
const std::string &  msg 
)

Normal Constructor for the CanteraError base class.

In the constructor, a call to the Application class is made to store the strings associated with the generated error condition.

Parameters
procedureString name for the function within which the error was generated.
msgDescriptive string describing the type of error message.

Definition at line 18 of file ctexceptions.cpp.

References CanteraError::save().

virtual ~CanteraError ( )
throw (
)
inlinevirtual

Destructor for base class does nothing.

Definition at line 83 of file ctexceptions.h.

CanteraError ( )
inlineprotected

Protected default constructor discourages throwing errors containing no information.

Definition at line 101 of file ctexceptions.h.

CanteraError ( const std::string &  procedure)
explicitprotected

Constructor used by derived classes that override getMessage()

Definition at line 27 of file ctexceptions.cpp.

References CanteraError::save().

Member Function Documentation

const char * what ( ) const
throw (
)
void save ( )
std::string getMessage ( ) const
virtual

Method overridden by derived classes to formatted the error message.

Reimplemented in IndexError, and ArraySizeError.

Definition at line 59 of file ctexceptions.cpp.

References CanteraError::msg_.

Referenced by CanteraError::save(), and CanteraError::what().

virtual std::string getClass ( ) const
inlinevirtual

Method overridden by derived classes to indicate their type.

Reimplemented in IndexError, and ArraySizeError.

Definition at line 95 of file ctexceptions.h.

Referenced by CanteraError::what().

Member Data Documentation

std::string procedure_
protected

The name of the procedure where the exception occurred.

Definition at line 107 of file ctexceptions.h.

Referenced by CanteraError::save(), and CanteraError::what().

std::string msg_
private

Message associated with the exception.

Definition at line 110 of file ctexceptions.h.

Referenced by CanteraError::getMessage().

std::string formattedMessage_
mutableprivate

Formatted message returned by what()

Definition at line 111 of file ctexceptions.h.

Referenced by CanteraError::what().

bool saved_
private

Exception has already been saved to Cantera's error stack.

Definition at line 112 of file ctexceptions.h.

Referenced by CanteraError::save().


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