What is the difference in getting exception message via str(e)
and e.message
in
except Exception as e:
...
block of code
What is the difference in getting exception message via str(e)
and e.message
in
except Exception as e:
...
block of code
If e
doesn't have a message
attribute, e.message
will raise an AttributeError
. str(e)
, on the other hand, won't do anything worse than return an empty string.