How do you find what exceptions a class can throw?

Terry Reedy tjreedy at udel.edu
Mon Dec 21 14:35:27 EST 2020


On 12/21/2020 4:06 AM, Chris Green wrote:
> 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.
...
 > It didn't seem such a difficult question when I asked it! :-)


Please acknowledge that this is *not* what you asked.

"I am using poplib.POP3_SSL() and I want to know what exceptions can be 
thrown when I instantiate it. "

If you had just asked "What is the name of a possible timeout error" 
someone would have answered just that.

-- 
Terry Jan Reedy



More information about the Python-list mailing list