Exclude HTTPExceptions from the all_exception_handler as they should be returned as-is. Fixes #3961

This commit is contained in:
Navnath Gadakh 2019-02-04 10:31:47 +00:00 committed by Dave Page
parent 9c21c07fc4
commit 5fdc1ffb38
2 changed files with 11 additions and 1 deletions

View File

@ -47,4 +47,5 @@ Bug fixes
| `Bug #3935 <https://redmine.postgresql.org/issues/3935>`_ - Ensure that grant wizard should list down functions for EPAS server running with no-redwood-compat mode.
| `Bug #3941 <https://redmine.postgresql.org/issues/3941>`_ - Dashboard graph optimization.
| `Bug #3954 <https://redmine.postgresql.org/issues/3954>`_ - Remove Python 2.6 code that's now obsolete.
| `Bug #3955 <https://redmine.postgresql.org/issues/3955>`_ - Expose the bind address in the Docker container via PGADMIN_BIND_ADDRESS.
| `Bug #3955 <https://redmine.postgresql.org/issues/3955>`_ - Expose the bind address in the Docker container via PGADMIN_BIND_ADDRESS.
| `Bug #3961 <https://redmine.postgresql.org/issues/3961>`_ - Exclude HTTPExceptions from the all_exception_handler as they should be returned as-is.

View File

@ -16,6 +16,7 @@ from collections import defaultdict
from importlib import import_module
from flask import Flask, abort, request, current_app, session, url_for
from werkzeug.exceptions import HTTPException
from flask_babelex import Babel, gettext
from flask_login import user_logged_in, user_logged_out
from flask_mail import Mail
@ -669,6 +670,14 @@ def create_app(app_name=None):
current_app.logger.error(e, exc_info=True)
return internal_server_error(errormsg=str(e))
# Exclude HTTPexception from above handler (all_exception_handler)
# HTTPException are user defined exceptions and those should be returned
# as is
@app.errorhandler(HTTPException)
def http_exception_handler(e):
current_app.logger.error(e, exc_info=True)
return e
##########################################################################
# All done!
##########################################################################