How do you find what exceptions a class can throw?
Chris Green
cl at isbd.net
Mon Dec 21 04:06:02 EST 2020
Avi Gross <avigross at verizon.net> wrote:
> The original question sounded like someone was asking what errors might be
> thrown for a routine they wrote that used other components that might
> directly throw exceptions or called yet others, ad nauseum.
>
OP here. The original question was because I wanted to trap timout
errors when connectiing to a POP3 server in a very simple little
program that collects mail and runs it through a filter before
delivering it.
Thus I simply needed to know what the 'name' of the exception was so I
could trap only timeouts. Timeout errors are (probably) 'soft' errors
which merit a retry, most other errors when trying to connect to a POP
server would be unrecoverable (POP syntax, wrong name, wrong password,
etc.).
It didn't seem such a difficult question when I asked it! :-)
--
Chris Green
ยท
More information about the Python-list
mailing list