Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make python catch verbose
authorFabien Chaix <chaix@ics.forth.gr>
Tue, 1 Mar 2022 12:56:34 +0000 (14:56 +0200)
committerFabien Chaix <chaix@ics.forth.gr>
Tue, 1 Mar 2022 12:56:34 +0000 (14:56 +0200)
src/bindings/python/simgrid_python.cpp

index 288c0cf..87b68bd 100644 (file)
@@ -218,8 +218,16 @@ PYBIND11_MODULE(simgrid, m)
                 if (py::isinstance<py::function>(res))
                   res();
               } catch (const py::error_already_set& ex) {
-                XBT_VERB("Actor killed");
-                simgrid::ForcefulKillException::do_throw();
+                XBT_VERB("Actor killed because %s",ex.what());
+               if(ex.matches(PyExc_FileNotFoundError)) {
+                  XBT_INFO("Took if");
+                 simgrid::ForcefulKillException::do_throw();
+               } 
+                XBT_INFO("Over");
+               //if(ex.matches(PyExc_RuntimeError)) {
+                //  simgrid::ForcefulKillException::do_throw();
+               //} else
+               //  xbt_die("Did not expect this kind of exception from Python");
                 throw;
               }
             });
@@ -742,8 +750,12 @@ PYBIND11_MODULE(simgrid, m)
                 py::gil_scoped_acquire py_context;
                 fun(*args);
               } catch (const py::error_already_set& ex) {
-                XBT_VERB("Actor killed");
-                simgrid::ForcefulKillException::do_throw();
+                XBT_INFO("Actor killed because %s",ex.what());
+               if(ex.matches(PyExc_FileNotFoundError)) {
+                  XBT_INFO("Took if");
+                 simgrid::ForcefulKillException::do_throw();
+               } 
+                XBT_INFO("Over");
                 throw;
               }
             });