[IronPython] How to get a System.Exception inside a IronPython except: clause

Dino Viehland dinov at exchange.microsoft.com
Wed Jul 9 01:39:35 CEST 2008


There's a clsException property that we add to Python exceptions that will give you the CLR Exception for the corresponding Python Exception.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dan Eloff
Sent: Tuesday, July 08, 2008 4:37 PM
To: Discussion of IronPython
Subject: [IronPython] How to get a System.Exception inside a IronPython except: clause

This may sound a little similar to some of my other posts on here, the
help I received previously has enabled me to get stuck in new and
exciting areas :)

The stdlib traceback module can be used to format python exceptions,
but unfortunately it seems to leave out some information, like clr
exception data (thanks Curt and Jimmy for helping me turn that on). So
now I find myself thinking how to use
Application.Current.Environment.GetEngine('py').FormatException()
(thanks Dino) to do a better job. The only trouble is it wants a clr
Exception, not a ValueError. Is there any way to call this function
with the tools available inside of an except: clause ?

Thanks,
-Dan
_______________________________________________
Users mailing list
Users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list