How to print the arguments of all types of exception caught in the below code snippet?
I want to catch all the exceptions and send the message as string to another function(say, "note_this_error"). By message, I mean whatever gets printed on the screen had there not been any exception handling code.
try:
::
except Exception as e:
print e.args
note_this_error (exception_message_as_string)
I saw the following on Official Python docs:
When an exception occurs, it may have an associated value, also known as the exception’s argument. The presence and type of the argument depend on the exception type.
I use Python 2.7