File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -507,3 +507,28 @@ def index():
507507 with app .test_client () as client :
508508 response = client .get ("/" )
509509 assert response .status_code == 200
510+
511+
512+ @pytest .mark .parametrize ("exc_cls" , [ZeroDivisionError , Exception ])
513+ def test_errorhandler_for_exception_swallows_exception (
514+ sentry_init , app , capture_events , exc_cls
515+ ):
516+ # In contrast to error handlers for a status code, error
517+ # handlers for exceptions can swallow the exception (this is
518+ # just how the Flask signal works)
519+ sentry_init (integrations = [flask_sentry .FlaskIntegration ()])
520+ events = capture_events ()
521+
522+ @app .route ("/" )
523+ def index ():
524+ 1 / 0
525+
526+ @app .errorhandler (exc_cls )
527+ def zerodivision (e ):
528+ return "ok"
529+
530+ with app .test_client () as client :
531+ response = client .get ("/" )
532+ assert response .status_code == 200
533+
534+ assert not events
You can’t perform that action at this time.
0 commit comments