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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Garabatus Raptus
Sent: Wednesday, August 01, 2007 10:20 AM
To: [email protected]
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
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to