I have a question regarding try/except
. I have an exception (lets call it FooException
) that has a status_code
in it. I want to handle the exception just if the status_code
is 200.
I would do something like:
try:
...
except FooException as ex:
if ex.status_code == 200:
# do something
else:
# do something else
Is there any other way or this one should go fine?
Thanks!