Message6899
Hi Robert:
In message <1585121254.8.0.412971837801.issue2551083@roundup.psfhosted.org>,
Robert Klonner writes:
>In roundup/exceptions.py there are some exceptions defined which are derived
>from BaseException. I have a use case where I have to handle those exceptions
>but I can't because they are using BaseException directly. I would have to
>catch it with "except BaseException:" which would result in also catching
>signals like keyboard interrupts or system exits).
IIRC BaseException was the way it was done in earlier 2.2 pythons. The
code base is showing its age.
I am interested in your use case. AFAIK you can always:
from exceptions import *
then use
try:
...
except (exception1, exception2, exception3 ...):
(I may be off on the syntax but you get the idea). Then list each
exception you want to catch. Clumsy but workable. However if a new
exception is added you will need to change your code 8-(.
I see Ralf is already on this ticket. Ralf are you working it?
I think (as recommended) a:
class RoundupException(Exception):
pass
and substituting BaseException/Exception in all class definitions with
RoundupException makes sense and follows recommended exception
hierarchy guidelines.
Does anybody see a problem with this? Any cases where this change may
break something?
I would like to get this in the 2.0 beta release (was planning on
starting the release sequence this weekend). Robert I assume you can
test it for your use case? |
|
Date |
User |
Action |
Args |
2020-03-25 20:21:36 | rouilj | set | recipients:
+ rouilj, schlatterbeck, tttech-klonner |
2020-03-25 20:21:36 | rouilj | link | issue2551083 messages |
2020-03-25 20:21:35 | rouilj | create | |
|