title: Retrieving the translated text of a custom exception in Django
body: <p>I am raising a custom exception like that:</p>
  <pre><code>from django.utils.translation import gettext as _
  
  class File_Upload_Exception(Exception):
      pass
  
  def myfn():
      raise File_Upload_Exception(_('FILE_TYPE_NOT_ALLOWED'))
  </code></pre>
  <p>My question: How do I get the exception message? The below gives the following error: <code>File_Upload_Exception is not JSON serializable</code></p>
  <pre><code>try:
      myfn()
  except File_Upload_Exception as e:
      print(e) #I want to retrieve the message &quot;File type not allowed&quot;
  </code></pre>