2qdxy4rzwzuui...@potatochowder.com wrote: > On 2020-12-20 at 16:02:53 +0000, > Regarding "Re: How do you find what exceptions a class can throw?," > Chris Green <c...@isbd.net> wrote: > > > Stefan Ram <r...@zedat.fu-berlin.de> wrote: > > > Chris Green <c...@isbd.net> writes: > > > >I am using poplib.POP3_SSL() and I want to know what exceptions can be > > > >thrown when I instantiate it. Presumably it inherits them because > > > >there's nothing much in the documentation page for poplib.POP3_SSL(). > > > > > > Both Java and C++ have tried to introduce a static > > > declaration of exceptions IIRC, but IIRC this was less > > > popular as it led to problems. > > > > > > Ultimately, it is not possible to tell what exceptions > > > a call might throw. In such a case, it may help to explain > > > to the newsgroup why this information is needed. > > > > > So that, as is always advised, I can catch the specific exception > > being thrown! > > To the point: what are you going to do with it once you catch it? > > Are you prepared to handle every exception individually, or are you > fishing for exceptions that you think might be worth catching? > > Remember, you get reporting (a traceback) and program cleanup and exit > for free. What will catching an exception *add* to the user experience?
If it's a timeout exception I'm going to delay a little while and then try again. The timeout is probably because the server is busy. If it's not a timeout then I'll (as you suggest) leave it to terminate the program and report the error. -- Chris Green ยท -- https://mail.python.org/mailman/listinfo/python-list