S_Context context(running_sess_->get_context());
modules = context->get_module_iter();
} catch (const sysrepo_exception& ex) {
- cerr << "ERROR: Can't retrieve available modules: " << ex.what() << endl;
- exit(1);
+ isc_throw(Unexpected, "can't retrieve available modules: " << ex.what());
}
for (S_Module const& module : modules) {
if (!module->name()) {
- cerr << "ERROR: module name is mangled" << endl;
- exit(2);
+ isc_throw(Unexpected, "could not retrieve module name");
}
string const name(module->name());
if (!module->rev() || !module->rev()->date()) {
- cerr << "ERROR: module revision is mangled" << endl;
- exit(3);
+ isc_throw(Unexpected,
+ "could not retrieve module revision for module " << name);
}
string const revision(module->rev()->date());
modules_.emplace(name, revision);
}
if (faulty_model) {
- cerr << "ERROR: The logged YANG module is missing or its revision is not "
- "supported. The environment is not suitable for running "
- "kea-netconf."
- << endl;
- exit(4);
+ isc_throw(Unexpected, "YANG module is missing or its revision is not "
+ "supported. Check logs for details.");
}
for (auto modrev : YANG_REVISIONS) {
///
/// Emit a fatal error if an essential one (i.e. required in
/// a further phase) is missing or does not have the expected revision.
- /// The caller (init) will exit().
///
/// @param module_name The module name.
/// @return true if available, false if not.
bool check_only) {
// Do a sanity check first.
if (!config_set) {
- isc_throw(DhcpConfigError, "Mandatory config parameter not provided");
+ isc_throw(ConfigError, "Mandatory config parameter not provided");
}
NetconfConfigPtr ctx = getNetconfConfig();