From 4d1e23eaea32641b1825a1cd79245ef7807c4fe2 Mon Sep 17 00:00:00 2001 From: Damien Dupuis Date: Tue, 6 Apr 2010 11:45:03 +0000 Subject: [PATCH] Added DTRException translator to python world --- vlsisapd/dtr/src/PyTechno.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/vlsisapd/dtr/src/PyTechno.cpp b/vlsisapd/dtr/src/PyTechno.cpp index c60459c6..650a3f67 100644 --- a/vlsisapd/dtr/src/PyTechno.cpp +++ b/vlsisapd/dtr/src/PyTechno.cpp @@ -3,8 +3,13 @@ using namespace boost::python; #include "io/dtr/Techno.h" #include "io/dtr/Rules.h" +#include "io/dtr/DTRException.h" namespace DTR { +void translator(DTRException const& e) { + PyErr_SetString(PyExc_UserWarning, e.what()); +} + BOOST_PYTHON_MODULE(pyDTR) { // class DTR::Name class_("Name", init()) @@ -39,5 +44,9 @@ BOOST_PYTHON_MODULE(pyDTR) { .def("getValue" , static_cast(&Techno::getValue)) .def("getValue" , static_cast(&Techno::getValue)) ; + + // DTRException translator + register_exception_translator(translator) + ; } }