11 #ifndef CT_CTEXCEPTIONS_H 12 #define CT_CTEXCEPTIONS_H 78 template <
typename... Args>
83 if (
sizeof...(args) == 0) {
86 msg_ = fmt::format(msg, args...);
94 const char*
what()
const throw();
101 return "CanteraError";
146 return "ArraySizeError";
172 IndexError(
const std::string& func,
const std::string& arrayName,
size_t m,
size_t mmax) :
173 CanteraError(func), arrayName_(arrayName), m_(m), mmax_(mmax) {}
182 std::string arrayName_;
194 return "NotImplementedError";
199 #define XSTR_TRACE_LINE(s) STR_TRACE_LINE(s) 202 #define STR_TRACE_LINE(s) #s 208 #define STR_TRACE (std::string(__FILE__) + ":" + XSTR_TRACE_LINE(__LINE__)) 212 # define AssertTrace(expr) ((void) (0)) 215 # define AssertThrow(expr, procedure) ((void) (0)) 217 #ifndef AssertThrowMsg 218 # define AssertThrowMsg(expr,procedure, ...) ((void) (0)) 233 # define AssertTrace(expr) ((expr) ? (void) 0 : throw CanteraError(STR_TRACE, std::string("failed assert: ") + #expr)) 247 # define AssertThrow(expr, procedure) ((expr) ? (void) 0 : throw CanteraError(procedure, std::string("failed assert: ") + #expr)) 263 #ifndef AssertThrowMsg 264 # define AssertThrowMsg(expr, procedure, ...) ((expr) ? (void) 0 : throw CanteraError(procedure + std::string(":\nfailed assert: \"") + std::string(#expr) + std::string("\""), __VA_ARGS__)) 271 # define AssertFinite(expr, procedure, ...) AssertThrowMsg(expr < BigNumber && expr > -BigNumber, procedure, __VA_ARGS__) IndexError(const std::string &func, const std::string &arrayName, size_t m, size_t mmax)
Constructor.
Wrapper for either system-installed or local headers for fmt.
std::string formattedMessage_
Formatted message returned by what()
An error indicating that an unimplemented function has been called.
std::string msg_
Message associated with the exception.
virtual std::string getMessage() const
Method overridden by derived classes to format the error message.
const char * what() const
Get a description of the error.
virtual std::string getMessage() const
Method overridden by derived classes to format the error message.
virtual std::string getMessage() const
Method overridden by derived classes to format the error message.
std::string procedure_
The name of the procedure where the exception occurred.
Base class for exceptions thrown by Cantera classes.
CanteraError()
Protected default constructor discourages throwing errors containing no information.
ArraySizeError(const std::string &procedure, size_t sz, size_t reqd)
Constructor.
CanteraError(const std::string &procedure, const std::string &msg, const Args &... args)
Normal Constructor for the CanteraError base class.
virtual std::string getClass() const
Method overridden by derived classes to indicate their type.
An array index is out of range.
Namespace for the Cantera kernel.
virtual std::string getClass() const
Method overridden by derived classes to indicate their type.
virtual std::string getClass() const
Method overridden by derived classes to indicate their type.
virtual std::string getClass() const
Method overridden by derived classes to indicate their type.
virtual ~CanteraError()
Destructor for base class does nothing.