I’m embedding IronPython 2.0 in C#. In IronPython, I defined my own exception with:
def foobarException(Exception): pass
and raise it somewhere with:
raise foobarException( 'This is the Exception Message' )
Now in C#, I have:
try { callIronPython(); } catch (Exception e) { // How can I determine the name (foobarException) of the Exception // that is thrown from IronPython? // With e.Message, I get 'This is the Exception Message' }
My final solution was:
I have a result class in C# which is passed to my ironpython code. In Ironpython I fill the result class with all my computed values. To this class I just added a member variable IronPythonExceptionName. Now I just have a simple try in IronPython: