Skip to content

Commit

Permalink
[XML] Improve error message generated by XML_NoChild
Browse files Browse the repository at this point in the history
  • Loading branch information
speth committed May 3, 2016
1 parent 6003af0 commit 26b9376
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/base/xml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,12 @@ class XML_NoChild : public XML_Error
XML_NoChild(const XML_Node* p, const std::string& parent,
std::string child, int line=0) :
XML_Error(line) {
m_msg += " The XML Node \"" + parent +
"\", does not contain a required\n" +
" XML child node named \""
+ child + "\".\n";
ostringstream ss(ostringstream::out);
p->write(ss,1);
m_msg += ss.str() + "\n";
m_msg += fmt::format("The XML Node <{}> does not contain a required "
"child node named <{}>.\nExisting children are named:\n",
parent, child);
for (auto cnode : p->children()) {
m_msg += fmt::format(" <{}>\n", cnode->name());
}
}

virtual std::string getClass() const {
Expand Down

0 comments on commit 26b9376

Please sign in to comment.