Improve error messages generated by XML_NoChild and XML_TagMismatch
This commit is contained in:
parent
c1fda5ca3c
commit
decf251a8b
2 changed files with 17 additions and 3 deletions
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 </" + closetag + ">.\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";
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue