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

Dan Eloff dan.eloff at gmail.com
Wed Jul 9 02:41:14 CEST 2008


Thanks Dino, That works.

Unfortunately FormatException() doesn't add the CLR stack trace, even
if it has been enabled in silverlight. If the exception is on the main
thread, and if it isn't thrown by the target of an invokation, and you
allow the exception to reach the top of the stack, you can see the CLR
stack trace. I guess for now, when I need to see the CLR stack trace,
the only way around that is to rearrange code so that those conditions
are met.

Is there anything that can (should?) be done about that?

-Dan

On Tue, Jul 8, 2008 at 6:39 PM, Dino Viehland
<dinov at exchange.microsoft.com> wrote:
> 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
> _______________________________________________
> 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