From: Tomek Mrugalski Date: Thu, 4 Oct 2018 20:54:33 +0000 (+0200) Subject: [#10,!3] Generator updated X-Git-Tag: 176-update-to-sysrepo-0-7-6-release_base~94 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b03227ed1680a9e246abe610c5e72636ab30af4f;p=thirdparty%2Fkea.git [#10,!3] Generator updated --- diff --git a/doc/docgen/kea_docgen.cc b/doc/docgen/kea_docgen.cc index 28b2ebb52d..bd22cb6641 100644 --- a/doc/docgen/kea_docgen.cc +++ b/doc/docgen/kea_docgen.cc @@ -38,6 +38,8 @@ public: int cnt = 0; + int errors = 0; // number of errors encountered + try { for (auto f : files) { string cmd = f; @@ -52,14 +54,24 @@ public: continue; } - cout << "Loading description of command " << cmd << "... "; - ElementPtr x = Element::fromJSONFile(f, false); - cout << "loaded, sanity check..."; + try { + cout << "Loading description of command " << cmd << "... "; + ElementPtr x = Element::fromJSONFile(f, false); + cout << "loaded, sanity check..."; + + sanityCheck(f, x); - sanityCheck(f, x); + cmds_.insert(make_pair(cmd, x)); + cout << " looks ok." << endl; - cmds_.insert(make_pair(cmd, x)); - cout << " looks ok." << endl; + } catch (const exception& e) { + cout << "ERROR: " << e.what() << endl; + errors++; + } + + if (errors) { + continue; + } cnt++; } @@ -69,7 +81,10 @@ public: } cout << "Loaded " << cmds_.size() << " commands out of " << files.size() - << " file(s)" << endl; + << " file(s), " << errors << " error(s) detected." << endl; + if (errors) { + isc_throw(Unexpected, errors << " error(s) detected while loading JSON files"); + } } /// @brief checks if mandatory string parameter is specified @@ -412,7 +427,7 @@ public: << "}" << endl; } if (cmd->contains("cmd-comment")) { - f << cmd->get("cmd-comment")->stringValue(); + f << escapeString(cmd->get("cmd-comment")->stringValue()); } f << "" << endl << endl;