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:
Pavel Emelyanov
2022-09-29 11:20:36 +03:00
parent d60ebc5ace
commit fa613285e7

View File

@@ -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