--- Begin Message ---
------------------------------------------------------------
revno: 4696
committer: Johan Hake <hake.dev@xxxxxxxxx>
branch nick: dolfin
timestamp: Fri 2010-04-23 15:11:36 -0700
message:
Errors originating in Python, in subclassed director methods, are now printed to screen.
-- A feature from the passed has returned!
modified:
dolfin/swig/exceptions.i
--
lp:dolfin
https://code.launchpad.net/~dolfin-core/dolfin/main
Your team DOLFIN Core Team is subscribed to branch lp:dolfin.
To unsubscribe from this branch go to https://code.launchpad.net/~dolfin-core/dolfin/main/+edit-subscription
=== modified file 'dolfin/swig/exceptions.i'
--- dolfin/swig/exceptions.i 2009-10-07 11:18:10 +0000
+++ dolfin/swig/exceptions.i 2010-04-23 22:11:36 +0000
@@ -5,7 +5,7 @@
// Modified by Johan Hake, 2009.
//
// First added: 2007-05-15
-// Last changed: 2009-09-24
+// Last changed: 2010-04-23
// ===========================================================================
// SWIG directives for exception handling in PyDOLFIN
@@ -26,19 +26,17 @@
catch (std::logic_error &e) {
PyErr_SetString(PyExc_StandardError, const_cast<char*>(e.what()));
}
+
// all runtime_error subclasses
catch (std::runtime_error &e) {
PyErr_SetString(PyExc_RuntimeError, const_cast<char*>(e.what()));
}
+
// all the rest
catch (std::exception &e) {
PyErr_SetString(PyExc_Exception, const_cast<char*>(e.what()));
}
- // director exceptions
- catch (Swig::DirectorException &e) {
- PyErr_SetString(PyExc_Exception, const_cast<char*>(e.getMessage()));
- }
}
%}
@@ -50,7 +48,10 @@
$action
}
catch (...){
- handle_dolfin_exceptions();
+ // No need to call PyErr_SetString if the error originates from Python
+ if (!PyErr_Occurred()) {
+ handle_dolfin_exceptions();
+ }
SWIG_fail;
}
}
--- End Message ---