@@ -328,33 +328,22 @@ def __del__(self):
328328 if self in _InstrumentedFalconAPI ._instrumented_falcon_apps :
329329 _InstrumentedFalconAPI ._instrumented_falcon_apps .remove (self )
330330
331- if _falcon_version == 1 :
332-
333- def _handle_exception (self , ex , req , resp , params ):
334- # Falcon 3 does not execute middleware within the context
335- # of the exception so we capture the exception here and
336- # save it into the env dict
337- if not self ._is_instrumented_by_opentelemetry :
338- return super ()._handle_exception (ex , req , resp , params )
339-
340- _ , exc , _ = exc_info ()
341- req .env [_ENVIRON_EXC ] = exc
342-
343- return super ()._handle_exception (ex , req , resp , params )
344-
345- else :
331+ def _handle_exception (self , * args ):
332+ # Falcon 3 does not execute middleware within the context
333+ # of the exception so we capture the exception here and
334+ # save it into the env dict
335+ if not self ._is_instrumented_by_opentelemetry :
336+ return super ()._handle_exception (* args )
346337
347- def _handle_exception (self , req , resp , ex , params ):
348- # Falcon 3 does not execute middleware within the context
349- # of the exception so we capture the exception here and
350- # save it into the env dict
351- if not self ._is_instrumented_by_opentelemetry :
352- return super ()._handle_exception (req , resp , ex , params )
338+ if _falcon_version == 1 :
339+ _ , req , _ , _ = args # ex, req, resp, params
340+ else :
341+ req , _ , _ , _ = args # req, resp, ex, params
353342
354- _ , exc , _ = exc_info ()
355- req .env [_ENVIRON_EXC ] = exc
343+ _ , exc , _ = exc_info ()
344+ req .env [_ENVIRON_EXC ] = exc
356345
357- return super ()._handle_exception (req , resp , ex , params )
346+ return super ()._handle_exception (* args )
358347
359348 def __call__ (self , env , start_response ):
360349 # pylint: disable=E1101
0 commit comments