File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 55class BaseActionExceptionMixin (HTTPException ):
66 """ An HTTP exception for when an action can't be performed """
77 response = None
8+ no_rollbar = True
89
910 def __init__ (self , action = None ):
1011 super (BaseActionExceptionMixin , self ).__init__ ()
@@ -39,6 +40,7 @@ class WrappedException(HTTPException):
3940 Wraps an exception in HTTPException so that it can have a status code
4041 """
4142 response = None
43+ no_rollbar = True
4244
4345 def __init__ (self , ex ):
4446 super (WrappedException , self ).__init__ ()
Original file line number Diff line number Diff line change @@ -122,6 +122,14 @@ def app_init():
122122 app_init_workers ()
123123
124124
125+ def wrapped_report_exception (app , exception ):
126+ """ Wrapper for ``report_exception`` to ignore some exceptions """
127+ if getattr (exception , 'no_rollbar' , False ):
128+ return
129+
130+ return rollbar .contrib .flask .report_exception (app , exception )
131+
132+
125133def app_init_rollbar ():
126134 """ Initialize Rollbar for error/exception reporting """
127135 try :
@@ -138,9 +146,7 @@ def app_init_rollbar():
138146 allow_logging_basic_config = False ,
139147 )
140148
141- flask .got_request_exception .connect (
142- rollbar .contrib .flask .report_exception , APP ,
143- )
149+ flask .got_request_exception .connect (wrapped_report_exception , APP )
144150
145151
146152def app_init_workers ():
You can’t perform that action at this time.
0 commit comments