I am communicating with an API that raises an exception like this: raise Exception("end of time")
.
How do I catch Exception
only when the string argument is "end of time"?
I don't want to do:
except Exception:
pass
I want to do something like:
except Exception("end of time"):
pass
However, this does not catch the exception.
Example traceback:
File "test.py", line 250, in timeout_handler
raise Exception("end of time")
Exception: end of time