title: django raise the exception somewhere
body: <pre><code>SOCIAL_AUTH_PIPELINE = (
      'social.pipeline.social_auth.associate_by_email',
  )
  </code></pre>
  
  <p>by using the above code in <code>settings.py</code> i can avoid...</p>
  
  <p><code>(1062, "Duplicate entry 'example@example.com' for key 'email'")</code> error message.</p>
  
  <p>But i searched online and i found this handy code to throw <code>exception</code> in desired html page:</p>
  
  <p><strong>[Code 1]:</strong>
  <strong>#backends.py</strong></p>
  
  <pre><code>class MySocialAuthExceptionMiddleware(SocialAuthExceptionMiddleware):
      def process_exception(self, request, exception):
          msg = None
          if #no duplicate email:
              return HttpResponse("# catched exception")
          else:
              # processing msg here
              return render_to_response(# html, {msg}, context)
  </code></pre>
  
  <p><strong># settings.py</strong></p>
  
  <pre><code>MIDDLEWARE_CLASSES = (
      'frontend.backends.MySocialAuthExceptionMiddleware'
  )
  </code></pre>
  
  <p>My problem is <code>solved</code> by based on the above code. But in previously i worked with another one functionality with the following code and it is entirely different from the above concept.</p>
  
  <p><strong>[Code 2]:</strong></p>
  
  <pre><code>def function(request):
      #actual code here
      return HttpResponse('msg here')
  </code></pre>
  
  <p>But while running the above code, and i got the error message like,</p>
  
  <p><strong><code>tuple index out of range</code> in this <code>MySocialAuthExceptionMiddleware</code>..</strong></p>
  
  <p>Actually this is not correct error message for the above code.. This message is related to the code of "<strong>[Code 1]</strong>".</p>
  
  <p>Then, how can i get the actual error message for "<strong>[Code 2]</strong>".</p>