[IronPython] SslStream exception

Dino Viehland dinov at exchange.microsoft.com
Wed Aug 1 10:50:32 PDT 2007

You have two options: You can catch a Python exception or a .NET exception, and you'll get either the Python exception object or the .NET exception object.  To catch a .NET exception as a Python exception you need to catch the closest base exception which might be Exception or SystemError (if you let the exception go unhandled it's whatever gets reported there).  To catch the .NET exception you just need to grab it from the correct namespace, for example:

        # do something
except System.ArgumentException, ex:
        print ex

and ex will end up being the ArgumentException instance.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Garabatus Raptus
Sent: Wednesday, August 01, 2007 10:20 AM
To: users at lists.ironpython.com
Subject: [IronPython] SslStream exception

Hi there,

I'm new to IronPython and I would like to know how can I catch an
exception generated by SslStream, Example:

client = TcpClient(self.server, self.port)

sslStream = SslStream( client.GetStream(), False,
RemoteCertificateValidationCallback (self.ValidateServerCertificate),

except <HERE?> :

   ....  <HERE?> ...

Is there any link where I can read about it and found some examples?


Users mailing list
Users at lists.ironpython.com

More information about the Users mailing list