catch boost::bad_function_call exceptions in server command handler

Don't know if this can actually happen in practice but it is
reported by coverity.
This commit is contained in:
Chris Beck 2014-11-17 19:11:37 -05:00
parent bb9aabd1b8
commit 8f9f3dd6f5

View file

@ -1387,7 +1387,12 @@ std::string server::process_command(std::string query, std::string issuer_name)
out << "Command '" << command << "' is not recognized.\n" << help_msg;
} else {
const cmd_handler &handler = handler_itor->second;
handler(this, issuer_name, query, parameters, &out);
try {
handler(this, issuer_name, query, parameters, &out);
} catch (boost::bad_function_call & ex) {
ERR_SERVER << "While handling a command '" << command << "', caught a boost::bad_function_call exception.\n";
ERR_SERVER << ex.what() << std::endl;
}
}
return out.str();