Skip to content

Commit

Permalink
catch boost::bad_function_call exceptions in server command handler
Browse files Browse the repository at this point in the history
Don't know if this can actually happen in practice but it is
reported by coverity.
  • Loading branch information
cbeck88 committed Nov 18, 2014
1 parent f6bdc94 commit c150a47
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/server/server.cpp
Expand Up @@ -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();
Expand Down

0 comments on commit c150a47

Please sign in to comment.