handle Python exceptions properly in get_context()

This commit is contained in:
rdb 2012-01-28 09:55:06 +00:00
parent ee3adf5723
commit 3c65b5171b

View File

@ -31,7 +31,14 @@
////////////////////////////////////////////////////////////////////
PyObject* EXT_CONST_METHOD(RocketRegion,
get_context) {
Rocket::Core::Context* context = _ext_this->get_context();
python::object py_context = Rocket::Core::Python::Utilities::MakeObject(context);
python::object py_context;
try {
Rocket::Core::Context* context = _ext_this->get_context();
py_context = Rocket::Core::Python::Utilities::MakeObject(context);
} catch (const python::error_already_set& e) {
return NULL;
}
return py_context.ptr();
}