title: How can you catch a custom exception from Celery worker, or stop it being prefixed with `celery.backends.base`?
body: <p>My Celery task raises a custom exception <code>NonTransientProcessingError</code>, which is then caught by <code>AsyncResult.get()</code>. Tasks.py:</p>
  
  <pre><code>class NonTransientProcessingError(Exception):
      pass
  
  @shared_task()
  def throw_exception():
      raise NonTransientProcessingError('Error raised by POC model for test purposes')
  </code></pre>
  
  <p>In the Python console:</p>
  
  <pre><code>from my_app.tasks import *
  r = throw_exception.apply_async()
  try:
      r.get()
  except NonTransientProcessingError as e:
      print('caught NonTrans in type specific except clause')
  </code></pre>
  
  <p>But my custom exception is <strong><code>my_app.tasks.</code></strong><code>NonTransientProcessingError</code>, whereas the exception raised by <code>AsyncResult.get()</code> is <strong><code>celery.backends.base.</code></strong><code>NonTransientProcessingError</code>, so my <code>except</code> clause fails.</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;input&gt;", line 4, in &lt;module&gt;
    File "/...venv/lib/python3.5/site-packages/celery/result.py", line 175, in get
      raise meta['result']
  celery.backends.base.NonTransientProcessingError: Error raised by POC model for test purposes
  </code></pre>
  
  <p>If I catch the exception within the task, it works fine. It is only when the exception is raised to the <code>.get()</code> call that it is renamed.</p>
  
  <p>How can I raise a custom exception and catch it correctly?</p>
  
  <p>I have confirmed that the same happens when I define a <code>Task</code> class and raise the custom exception in its <code>on_failure</code> method. The following does work:</p>
  
  <pre><code>try:
      r.get()
  except Exception as e:
      if type(e).__name__ == 'NonTransientProcessingError':
          print('specific exception identified')
      else:
          print('caught generic but not identified')
  </code></pre>
  
  <p>Outputs:</p>
  
  <pre><code>specific exception identified
  </code></pre>
  
  <p>But this can't be the best way of doing this? Ideally I'd like to catch exception superclasses for categories of behaviour.</p>
  
  <p>I'm using Django 1.8.6, Python 3.5 and Celery 3.1.18, with a Redis 3.1.18, Python redis lib 2.10.3 backend.</p>