def record_exception(exc_info): # Record the details of any exception ignoring status codes which # have been configured to be ignored. import tornado.web exc = exc_info[0] value = exc_info[1] # Not an error so we just return. if exc is tornado.web.Finish: return if exc is tornado.web.HTTPError: if ignore_status_code(value.status_code): return transaction = retrieve_current_transaction() if transaction: transaction.record_exception(*exc_info) else: # If we are not in a transaction we record the exception to the default # application specified in the agent configuration. application = application_instance() if application and application.enabled: application.record_exception(*exc_info)
def should_ignore(exc, value, tb): # The HTTPError class derives from HTTPResponse and so we do not # need to check for it seperately as isinstance() will pick it up. if isinstance(value, module_bottle.HTTPResponse): if hasattr(value, 'status_code'): if ignore_status_code(value.status_code): return True elif hasattr(value, 'status'): if ignore_status_code(value.status): return True elif hasattr(value, 'http_status_code'): if ignore_status_code(value.http_status_code): return True elif hasattr(module_bottle, 'RouteReset'): if isinstance(value, module_bottle.RouteReset): return True
def should_ignore(exc, value, tb): from werkzeug.exceptions import HTTPException # Werkzeug HTTPException can be raised internally by Flask or in # user code if they mix Flask with Werkzeug. Filter based on the # HTTP status code. if isinstance(value, HTTPException): if ignore_status_code(value.code): return True
def record_exception(transaction, exc_info): # Record the details of any exception ignoring status codes which # have been configured to be ignored. import tornado.web exc = exc_info[0] value = exc_info[1] if exc is tornado.web.HTTPError: if ignore_status_code(value.status_code): return transaction.record_exception(*exc_info)
def should_ignore(exc, value, tb): from pyramid.httpexceptions import HTTPException from pyramid.exceptions import PredicateMismatch # Ignore certain exceptions based on HTTP status codes. if isinstance(value, HTTPException): if ignore_status_code(value.code): return True # Always ignore PredicateMismatch as it is raised by views to force # subsequent views to be consulted when multi views are being used. # It isn't therefore strictly an error as such as a subsequent view # could still handle the request. See TODO items though for a corner # case where this can mean an error isn't logged when it should. if isinstance(value, PredicateMismatch): return True
def should_ignore(exc, value, tb): from cherrypy import HTTPError, HTTPRedirect # Ignore certain exceptions based on HTTP status codes. if isinstance(value, (HTTPError, HTTPRedirect)): if ignore_status_code(value.status): return True # Ignore certain exceptions based on their name. module = value.__class__.__module__ name = value.__class__.__name__ fullname = '%s:%s' % (module, name) ignore_exceptions = ('cherrypy._cperror:InternalRedirect',) if fullname in ignore_exceptions: return True
def should_ignore(exc, value, tb): from django.http import Http404 if isinstance(value, Http404): if ignore_status_code(404): return True