In python 2.6.6, how can I capture the error message of an exception.
IE:
response_dict = {} # contains info to response under a django view.
try:
Everything about str
is correct, yet another answer: an Exception
instance has message
attribute, and you may want to use it (if your customized IntegrityError
doesn't do something special):
except IntegrityError, e: #contains my own custom exception raising with custom messages.
response_dict.update({'error': e.message})