9 #ifndef CT_CTEXCEPTIONS_H
10 #define CT_CTEXCEPTIONS_H
80 CanteraError(
const std::string& procedure,
const std::string& msg);
86 const char*
what()
const throw();
96 return "CanteraError";
141 return "ArraySizeError";
167 IndexError(
const std::string& func,
const std::string& arrayName,
size_t m,
size_t mmax) :
168 CanteraError(func), arrayName_(arrayName), m_(m), mmax_(mmax) {}
177 std::string arrayName_;
182 #define XSTR_TRACE_LINE(s) STR_TRACE_LINE(s)
185 #define STR_TRACE_LINE(s) #s
191 #define STR_TRACE (std::string(__FILE__) + ":" + XSTR_TRACE_LINE(__LINE__))
195 # define AssertTrace(expr) ((void) (0))
198 # define AssertThrow(expr, procedure) ((void) (0))
200 #ifndef AssertThrowMsg
201 # define AssertThrowMsg(expr,procedure, message) ((void) (0))
216 # define AssertTrace(expr) ((expr) ? (void) 0 : throw Cantera::CanteraError(STR_TRACE, std::string("failed assert: ") + #expr))
229 # define AssertThrow(expr, procedure) ((expr) ? (void) 0 : throw Cantera::CanteraError(procedure, std::string("failed assert: ") + #expr))
246 #ifndef AssertThrowMsg
247 # define AssertThrowMsg(expr, procedure, message) ((expr) ? (void) 0 : throw Cantera::CanteraError(procedure + std::string(": at failed assert: \"") + std::string(#expr) + std::string("\""), message))
254 # define AssertFinite(expr, procedure, message) AssertThrowMsg(expr < BigNumber && expr > -BigNumber, procedure, message)
IndexError(const std::string &func, const std::string &arrayName, size_t m, size_t mmax)
Constructor.
std::string formattedMessage_
Formatted message returned by what()
bool saved_
Exception has already been saved to Cantera's error stack.
std::string msg_
Message associated with the exception.
virtual std::string getClass() const
Method overridden by derived classes to indicate their type.
virtual std::string getMessage() const
Method overridden by derived classes to formatted the error message.
const char * what() const
Get a description of the error.
std::string procedure_
The name of the procedure where the exception occurred.
Base class for exceptions thrown by Cantera classes.
virtual std::string getMessage() const
Method overridden by derived classes to formatted the error message.
CanteraError()
Protected default constructor discourages throwing errors containing no information.
virtual std::string getClass() const
Method overridden by derived classes to indicate their type.
virtual std::string getMessage() const
Method overridden by derived classes to formatted the error message.
ArraySizeError(const std::string &procedure, size_t sz, size_t reqd)
Constructor.
virtual std::string getClass() const
Method overridden by derived classes to indicate their type.
An array index is out of range.
void save()
Function to put this error onto Cantera's error stack.
virtual ~CanteraError()
Destructor for base class does nothing.