forked from orbit-oss/flask
deprecate should_ignore_error
This commit is contained in:
parent
9b74a90dd3
commit
c77a520343
3 changed files with 27 additions and 9 deletions
|
|
@ -995,6 +995,17 @@ class Flask(App):
|
|||
|
||||
.. versionadded:: 0.7
|
||||
"""
|
||||
if not self._got_first_request and self.should_ignore_error is not None:
|
||||
import warnings
|
||||
|
||||
warnings.warn(
|
||||
"The 'should_ignore_error' method is deprecated and will"
|
||||
" be removed in Flask 3.3. Handle errors as needed in"
|
||||
" teardown handlers instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=1,
|
||||
)
|
||||
|
||||
self._got_first_request = True
|
||||
|
||||
try:
|
||||
|
|
@ -1576,7 +1587,11 @@ class Flask(App):
|
|||
if "werkzeug.debug.preserve_context" in environ:
|
||||
environ["werkzeug.debug.preserve_context"](ctx)
|
||||
|
||||
if error is not None and self.should_ignore_error(error):
|
||||
if (
|
||||
error is not None
|
||||
and self.should_ignore_error is not None
|
||||
and self.should_ignore_error(error)
|
||||
):
|
||||
error = None
|
||||
|
||||
ctx.pop(error)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue