[IronPython] SslStream exception

Dino Viehland dinov at exchange.microsoft.com
Wed Aug 1 19:50:32 CEST 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:

try:
        # 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),
None)

try:
   sslStream.AuthenticateAsClient("secure.mydomain....")
except <HERE?> :

   ....  <HERE?> ...
   return

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

regards,

gara
_______________________________________________
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