Re: [IronPython] catching WebException from OpenReadAsync

2007-06-27 Thread Benjamin West
Ha. Thanks. -Ben On 6/27/07, John Messerly <[EMAIL PROTECTED]> wrote: > The "stream = args.Result" line in asyncReader is the culprit. The Result > property will throw if the read operation failed. You could move that line > inside the try block, so the exception is caught. Or alternatively, u

Re: [IronPython] catching WebException from OpenReadAsync

2007-06-27 Thread John Messerly
The "stream = args.Result" line in asyncReader is the culprit. The Result property will throw if the read operation failed. You could move that line inside the try block, so the exception is caught. Or alternatively, use the args.Exception property to determine if there was an error in the read.

[IronPython] catching WebException from OpenReadAsync

2007-06-27 Thread Benjamin West
Is this a bug or am I doing something wrong? $ cat webclient.py import clr import System from System import Uri from System.Net import WebClient, WebException class Foo: def __init__(self, uri): self.setup(uri) def setup(self, uri): self.uri = Uri