code: def handle_exception(self, e, request=None):
          
          if isinstance(e, HttpError):
              response = SerializedHttpResponse(e.content, status=e.status)
              return self.emit(
                  response, request=request, emitter=e.emitter)
  
          if isinstance(e, (AssertionError, ValidationError)):
  
              content = unicode(e)
  
              if isinstance(e, FormError):
                  content = e.form.errors
  
              response = SerializedHttpResponse(
                  content, status=status.HTTP_400_BAD_REQUEST)
  
              return self.emit(response, request=request)
  
          if ADREST_DEBUG:
              raise
  
          logger.exception('\nADREST API Error: %s', request.path)
  
          return HttpResponse(str(e), status=500)
docs: Handle code exception.
  
          :return response: Http response