From 4d304bcd8cd86eb74ba23903ea61e7a3ebff5599 Mon Sep 17 00:00:00 2001 From: Fabien Chaix Date: Tue, 1 Mar 2022 14:56:34 +0200 Subject: [PATCH] Make python catch verbose --- src/bindings/python/simgrid_python.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/bindings/python/simgrid_python.cpp b/src/bindings/python/simgrid_python.cpp index 288c0cfb02..87b68bdc2b 100644 --- a/src/bindings/python/simgrid_python.cpp +++ b/src/bindings/python/simgrid_python.cpp @@ -218,8 +218,16 @@ PYBIND11_MODULE(simgrid, m) if (py::isinstance(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; } }); -- 2.20.1