diff --git a/src/base/ctexceptions.cpp b/src/base/ctexceptions.cpp index 1eeb3a40a..2a71ad7f0 100644 --- a/src/base/ctexceptions.cpp +++ b/src/base/ctexceptions.cpp @@ -44,7 +44,11 @@ const char* CanteraError::what() const throw() try { formattedMessage_ = "\n"; formattedMessage_ += stars; - formattedMessage_ += getClass() + " thrown by " + procedure_ + ":\n" + getMessage(); + formattedMessage_ += getClass(); + if (procedure_.size()) { + formattedMessage_ += " thrown by " + procedure_; + } + formattedMessage_ += ":\n" + getMessage(); if (formattedMessage_.compare(formattedMessage_.size()-1, 1, "\n")) { formattedMessage_.append("\n"); } diff --git a/src/base/xml.cpp b/src/base/xml.cpp index 08ec8be95..48bd039ea 100644 --- a/src/base/xml.cpp +++ b/src/base/xml.cpp @@ -40,6 +40,10 @@ protected: m_msg += ".\n"; } + virtual std::string getMessage() const { + return m_msg; + } + //! destructor virtual ~XML_Error() throw() { } @@ -71,7 +75,10 @@ public: int line=0) : XML_Error(line) { m_msg += "<" + opentag + "> paired with .\n"; - setError("XML_TagMismatch", m_msg); + } + + virtual std::string getClass() const { + return "XML_TagMismatch"; } }; @@ -101,7 +108,10 @@ public: ostringstream ss(ostringstream::out); p->write(ss,1); m_msg += ss.str() + "\n"; - setError("XML_NoChild", m_msg); + } + + virtual std::string getClass() const { + return "XML_NoChild"; } };