3939
4040from newrelic .api .function_trace import FunctionTrace , wrap_function_trace
4141from newrelic .api .transaction import current_transaction
42- from newrelic .api .time_trace import record_exception
42+ from newrelic .api .time_trace import notice_error
4343from newrelic .api .wsgi_application import wrap_wsgi_application
4444from newrelic .common .object_names import callable_name
4545from newrelic .common .object_wrapper import (ObjectProxy , function_wrapper ,
4646 wrap_function_wrapper )
47- from newrelic .core .config import ignore_status_code
4847from newrelic .api .error_trace import wrap_error_trace
4948
5049
@@ -53,7 +52,7 @@ def framework_details():
5352 return ('CherryPy' , getattr (cherrypy , '__version__' , None ))
5453
5554
56- def should_ignore (exc , value , tb ):
55+ def status_code (exc , value , tb ):
5756 from cherrypy import HTTPError , HTTPRedirect
5857
5958 # Ignore certain exceptions based on HTTP status codes.
@@ -64,20 +63,7 @@ def should_ignore(exc, value, tb):
6463 # HTTPError("10 Bad error")), value will not have a code attr.
6564 # In both of those cases, we fall back to value.status
6665 code = getattr (value , 'code' , value .status )
67-
68- if ignore_status_code (code ):
69- return True
70-
71- # Ignore certain exceptions based on their name.
72-
73- module = value .__class__ .__module__
74- name = value .__class__ .__name__
75- fullname = '%s:%s' % (module , name )
76-
77- ignore_exceptions = ('cherrypy._cperror:InternalRedirect' ,)
78-
79- if fullname in ignore_exceptions :
80- return True
66+ return code
8167
8268
8369@function_wrapper
@@ -122,7 +108,7 @@ def wrapper_Dispatcher_find_handler(wrapped, instance, args, kwargs):
122108 except : # Catch all
123109 # Can end up here when a custom _cp_dispatch() method is
124110 # used and that raises an exception.
125- record_exception ()
111+ notice_error ()
126112 raise
127113
128114 if obj :
@@ -173,7 +159,7 @@ def wrapper_RoutesDispatcher_find_handler(wrapped, instance, args, kwargs):
173159
174160 except : # Catch all
175161 # Can end up here when the URL was invalid in some way.
176- record_exception ()
162+ notice_error ()
177163 raise
178164
179165 if handler :
@@ -206,7 +192,7 @@ def instrument_cherrypy__cpdispatch(module):
206192 wrap_function_wrapper (module , 'RoutesDispatcher.find_handler' ,
207193 wrapper_RoutesDispatcher_find_handler )
208194 wrap_error_trace (module , 'PageHandler.__call__' ,
209- ignore = should_ignore )
195+ ignore = [ 'cherrypy._cperror:InternalRedirect' ], status_code = status_code )
210196
211197
212198def instrument_cherrypy__cpwsgi (module ):
0 commit comments