title: Python: Getting the error message of an exception
body: <p>In python 2.6.6, how can I capture the error message of an exception.</p>
  
  <p>IE:</p>
  
  <pre><code>response_dict = {} # contains info to response under a django view.
  try:
      plan.save()
      response_dict.update({'plan_id': plan.id})
  except IntegrityError, e: #contains my own custom exception raising with custom messages.
      response_dict.update({'error': e})
  return HttpResponse(json.dumps(response_dict), mimetype="application/json")
  </code></pre>
  
  <p>This doesnt seem to work. I get:</p>
  
  <pre><code>IntegrityError('Conflicts are not allowed.',) is not JSON serializable
  </code></pre>