mirror of
https://github.com/varun-r-mallya/pylibbpf.git
synced 2025-12-31 20:36:26 +00:00
Return None instead of KeyError for failure of BpfMap::lookup for missing key
This commit is contained in:
@ -42,7 +42,7 @@ py::object BpfMap::lookup(const py::object &key) const {
|
||||
value_span.data(), value_size_, BPF_ANY);
|
||||
if (ret < 0) {
|
||||
if (ret == -ENOENT)
|
||||
throw py::key_error("Key not found in map '" + map_name_ + "'");
|
||||
return py::none();
|
||||
throw BpfException("Failed to lookup key in map '" + map_name_ +
|
||||
"': " + std::strerror(-ret));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user