topology: Make get_location() errors more verbose
Currently if topology.get_location() doesn't find an entry in its collection(s) it throws standard out-of-range exception which's very hard to debug. Also, next patches will extend this method, the introduced here if (_current_locations.contains()) makes this future change look nicer. Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
@@ -1299,7 +1299,11 @@ bool topology::has_endpoint(inet_address ep) const
|
||||
}
|
||||
|
||||
const endpoint_dc_rack& topology::get_location(const inet_address& ep) const {
|
||||
return _current_locations.at(ep);
|
||||
if (_current_locations.contains(ep)) {
|
||||
return _current_locations.at(ep);
|
||||
}
|
||||
|
||||
on_internal_error(tlogger, format("Node {} is not in topology", ep));
|
||||
}
|
||||
|
||||
// FIXME -- both methods below should rather return data from the
|
||||
|
||||
Reference in New Issue
Block a user