<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
thx man :)<br><br><hr id="stopSpelling">Date: Wed, 29 Dec 2010 13:37:35 +0000<br>From: rjnienaber@gmail.com<br>To: users@lists.ironpython.com<br>Subject: Re: [IronPython] is it possible to raise a System.Web.Exception        from IronPython?<br><br>> Is there any way tocatch this exception from IronPython<br><br>I'm not sure if there's a corresponding python exception but you can definitely catch the WebException:<br><br>C#:<br><span style="font-family:courier new,monospace">using System.Net;</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">public class RaiseException {</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> public void Raise() { throw new WebException("My Exception"); }</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">}</span><br><br>IronPython 2.6/2.7:<br><br><span style="font-family:courier new,monospace">import clr</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">from System.Net import WebException</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">clr.AddReference("RaiseException")</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">import RaiseException</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">o = RaiseException()</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">try:</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> o.Raise()</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">except WebException, e:</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> print e.Message #prints 'My Exception'</span><br><br><div class="ecxgmail_quote">On Wed, Dec 29, 2010 at 1:07 PM, Pablo Dalmazzo <span dir="ltr"><<a href="mailto:pablodalma93@hotmail.com">pablodalma93@hotmail.com</a>></span> wrote:<br>
<blockquote class="ecxgmail_quote" style="padding-left:1ex">
<div>
Sorry guys, I didnt mean to raise, I wanted to say TO CATCH<br><br><hr>From: <a href="mailto:pablodalma93@hotmail.com">pablodalma93@hotmail.com</a><br>To: <a href="mailto:users@lists.ironpython.com">users@lists.ironpython.com</a><br>
Date: Wed, 29 Dec 2010 10:05:07 -0300<br>Subject: [IronPython] is it possible to raise a System.Web.Exception from        IronPython?<div><div></div><div class="h5"><br><br>
<div>Hi there,</div><div><br></div>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<div>
catch this exception from IronPython or a workaround?</div><div><br></div><div>Greetings, Pablo<br><div><div><br></div><div><br></div></div></div>                                           
<br></div></div>_______________________________________________
Users mailing list
<a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a>                                            </div>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
<br></blockquote></div><br>
<br>_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com                                            </body>
</html>