Skip to content
Snippets Groups Projects
Unverified Commit 7c7b2284 authored by Benjamin Cumming's avatar Benjamin Cumming Committed by GitHub
Browse files

improve error diagnostics in python recipe (#1743)

parent d4e65e42
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <arbor/morph/primitives.hpp> #include <arbor/morph/primitives.hpp>
#include <arbor/recipe.hpp> #include <arbor/recipe.hpp>
#include "arbor/cable_cell_param.hpp"
#include "conversion.hpp" #include "conversion.hpp"
#include "error.hpp" #include "error.hpp"
#include "event_generator.hpp" #include "event_generator.hpp"
...@@ -70,6 +71,9 @@ static std::any convert_gprop(pybind11::object o) { ...@@ -70,6 +71,9 @@ static std::any convert_gprop(pybind11::object o) {
if (o.is(pybind11::none())) { if (o.is(pybind11::none())) {
return {}; return {};
} }
if (!pybind11::isinstance<arb::cable_cell_global_properties>(o)) {
throw pyarb_error("recipe.global_properties must return a valid description of cable cell properties of type arbor.cable_global_properties");
}
return pybind11::cast<arb::cable_cell_global_properties>(o); return pybind11::cast<arb::cable_cell_global_properties>(o);
} }
......
...@@ -48,7 +48,6 @@ public: ...@@ -48,7 +48,6 @@ public:
virtual pybind11::object global_properties(arb::cell_kind kind) const { virtual pybind11::object global_properties(arb::cell_kind kind) const {
return pybind11::none(); return pybind11::none();
}; };
//TODO: virtual pybind11::object global_properties(arb::cell_kind kind) const {return pybind11::none();};
}; };
class py_recipe_trampoline: public py_recipe { class py_recipe_trampoline: public py_recipe {
......
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