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.