Skip to content
Snippets Groups Projects
Unverified Commit 84a1ab53 authored by thorstenhater's avatar thorstenhater Committed by GitHub
Browse files

Raise KeyError in catalogue. (#1563)

* Raise KeyError in catalogue.
* Raise KeyError in label_dict.
parent 59ac676d
No related branches found
No related tags found
No related merge requests found
......@@ -220,7 +220,7 @@ void register_cells(pybind11::module& m) {
.def("__getitem__",
[](label_dict_proxy& l, const char* name) {
if (!l.cache.count(name)) {
throw std::runtime_error(util::pprintf("\nKeyError: '{}'", name));
throw pybind11::key_error(name);
}
return l.cache.at(name);
})
......
......@@ -135,7 +135,7 @@ void register_mechanisms(pybind11::module& m) {
return c[name];
}
catch (...) {
throw std::runtime_error(util::pprintf("\nKeyError: '{}'", name));
throw pybind11::key_error(name);
}
})
.def("extend", &arb::mechanism_catalogue::import,
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment