token_metadata: Do not assert in get_host_id

Throw an exception instead of assert.
This commit is contained in:
Asias He
2016-04-13 07:21:32 +08:00
parent 3734dcbace
commit ffe91b5755

View File

@@ -201,7 +201,9 @@ void token_metadata::update_host_id(const UUID& host_id, inet_address endpoint)
}
utils::UUID token_metadata::get_host_id(inet_address endpoint) {
assert(_endpoint_to_host_id_map.count(endpoint));
if (!_endpoint_to_host_id_map.count(endpoint)) {
std::runtime_error(sprint("host_id for endpoint %s is not found", endpoint));
}
return _endpoint_to_host_id_map.at(endpoint);
}