Example #1
0
 def process_exception(self, request, exc):
     """Process an exception.
     
     Hoptoad will be notified of the exception and None will be
     returned so that Django's normal exception handling will then
     be used.
     
     """
     if self._ignore(request):
         return None
     
     self.handler.enqueue(htv2.generate_payload((request, None)),
                          self.timeout)
     return None
Example #2
0
 def process_exception(self, request, exc):
     """Process an exception.
     
     Hoptoad will be notified of the exception and None will be
     returned so that Django's normal exception handling will then
     be used.
     
     """
     if not self._ignore(request, exc):
         try:
             payload = htv2.generate_payload((request, None))
             if self.debug: logging.debug("hoptoad: sending exception %r with %s"
                                          % (exc, self.handler.__class__.__name__))
             self.handler.enqueue(payload, self.timeout)
         except Exception, e:
             logging.exception(e)
Example #3
0
    def process_exception(self, request, exc):
        """Process an exception.

        Hoptoad will be notified of the exception and None will be
        returned so that Django's normal exception handling will then
        be used.

        """
        if self._ignore(request):
            return None

        if isinstance(exc, Http404) and not self.notify_404:
            return None

        payload = htv2.generate_payload(request, None, exception=exc)
        self.handler.enqueue(payload, self.timeout)

        return None
Example #4
0
    def process_exception(self, request, exc):
        """Process an exception.

        Hoptoad will be notified of the exception and None will be
        returned so that Django's normal exception handling will then
        be used.

        """
        if self._ignore(request):
            return None

        if isinstance(exc, Http404) and not self.notify_404:
            return None

        payload = htv2.generate_payload(request, None, exception=exc)
        self.handler.enqueue(payload, self.timeout)

        return None
Example #5
0
    def process_response(self, request, response):
        """Process a reponse object.

        Hoptoad will be notified of a 404 error if the response is a 404
        and 404 tracking is enabled in the settings.

        Hoptoad will be notified of a 403 error if the response is a 403
        and 403 tracking is enabled in the settings.

        Regardless of whether Hoptoad is notified, the reponse object will
        be returned unchanged.

        """
        if self._ignore(request):
            return response

        sc = response.status_code
        if sc in [404, 403] and getattr(self, "notify_%d" % sc):
            payload = htv2.generate_payload(request, sc, exception=None)
            self.handler.enqueue(payload, self.timeout)

        return response
Example #6
0
    def process_response(self, request, response):
        """Process a reponse object.

        Hoptoad will be notified of a 404 error if the response is a 404
        and 404 tracking is enabled in the settings.

        Hoptoad will be notified of a 403 error if the response is a 403
        and 403 tracking is enabled in the settings.

        Regardless of whether Hoptoad is notified, the reponse object will
        be returned unchanged.

        """
        if self._ignore(request):
            return response

        sc = response.status_code
        if sc in [404, 403] and getattr(self, "notify_%d" % sc):
            payload = htv2.generate_payload(request, sc, exception=None)
            self.handler.enqueue(payload, self.timeout)

        return response