[IronPython] is it possible to raise a System.Web.Exception from IronPython?

Pablo Dalmazzo pablodalma93 at hotmail.com
Wed Dec 29 15:02:18 CET 2010


thx man :)

Date: Wed, 29 Dec 2010 13:37:35 +0000
From: rjnienaber at gmail.com
To: users at lists.ironpython.com
Subject: Re: [IronPython] is it possible to raise a System.Web.Exception	from IronPython?

>  Is there any way tocatch this exception from IronPython

I'm not sure if there's a corresponding python exception but you can definitely catch the WebException:

C#:
using System.Net;
public class RaiseException {    public void Raise() { throw new WebException("My Exception"); }
}

IronPython 2.6/2.7:

import clrfrom System.Net import WebException
clr.AddReference("RaiseException")import RaiseException
o = RaiseException()try:
    o.Raise()except WebException, e:
    print e.Message     #prints 'My Exception'

On Wed, Dec 29, 2010 at 1:07 PM, Pablo Dalmazzo <pablodalma93 at hotmail.com> wrote:






Sorry guys, I didnt mean to raise, I wanted to say TO CATCH

From: pablodalma93 at hotmail.com
To: users at lists.ironpython.com

Date: Wed, 29 Dec 2010 10:05:07 -0300
Subject: [IronPython] is it possible to raise a System.Web.Exception from	IronPython?








Hi there,
I was reading Michael's book for exception handling and in the book he says when a .NET exception percolates through to IronPython, it’s wrapped as a Python exception, and that you can catch a lot of .NET exceptions using the equivalent Python exceptions, and he gives a link where there are listed .net exception and their equivalents Python exceptions. But  System.Web.Exception isnt there. Is there any way to
catch this exception from IronPython or a workaround?
Greetings, Pablo


 		 	   		  

_______________________________________________
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





_______________________________________________
Users mailing list
Users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20101229/11724d1f/attachment.html>


More information about the Ironpython-users mailing list