How do I find what kind of exception is thrown.
Antoon Pardon
antoon.pardon at rece.vub.ac.be
Tue Sep 5 14:10:41 EDT 2017
More information about the Python-list mailing list
Tue Sep 5 14:10:41 EDT 2017
- Previous message (by thread): How do I find what kind of exception is thrown.
- Next message (by thread): How do I find what kind of exception is thrown.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 05-09-17 13:39, Steve D'Aprano wrote: > On Tue, 5 Sep 2017 06:50 pm, Antoon Pardon wrote: > >> Python 2.6.4 on a solaris box. >> >> I have a program in which all kind of excptions can be thrown and caugth. >> The main program is something like below: >> >> try: >> do_stuff >> except Exception: >> log unexpected trouble >> >> Now I found the following in the logs: [Errno 131] Connection reset by peer >> >> This is a problem I would like to catch earlier however I have no idea what >> exception I would have to catch in order to treat this case. > > > try: > do_stuff > except Exception as err: > print err, type(err) Thabks, I should have thought of that. It turned out to be a socket.error, which wasn't obvious to find since I didn't use the socket module directly. -- Antoon Pardon.
- Previous message (by thread): How do I find what kind of exception is thrown.
- Next message (by thread): How do I find what kind of exception is thrown.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list