I have the following code and I am getting this Error which looks strange to me, as I have catch(...) which is equivalent to default. Am I missing anything? Please, let me know.
Basically, I have int run function what should be the return placed to resolve the error??
class AgentLauncher : FSWatcher::Watcher {
public:
AgentLauncher(bool watch_, std::vector<string>& configFiles_)
: watch(watch_), configFiles(configFiles_),
stopped(false), need_reload(false) {}
int run() {
try {
FSWatcher configWatcher;
addWatches(configWatcher);
configWatcher.setInitialScan(false);
configWatcher.start();
while (true) {
std::unique_lock<std::mutex> lock(mutex);
opflex::ofcore::OFFramework framework;
Agent agent(framework);
configure(agent);
agent.start();
cond.wait(lock, [this]{ return stopped || need_reload; });
if (!stopped && need_reload) {
LOG(INFO) << "Reloading agent because of " <<
"configuration update";
}
agent.stop();
if (stopped) {
return 0;
}
need_reload = false;
}
configWatcher.stop();
} catch (pt::json_parser_error& e) {
return 4;
} catch (const std::exception& e) {
LOG(ERROR) << "Fatal error: " << e.what();
return 2;
} catch (...) {
LOG(ERROR) << "Unknown fatal error";
return 3;
}
}
/* some more function */
};
Aucun commentaire:
Enregistrer un commentaire