mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 19:03:30 -05:00
don't log 404s as ERROR
This commit is contained in:
@@ -430,7 +430,6 @@ def useful_headers_after_request(response):
|
||||
|
||||
def register_errorhandlers(application): # noqa (C901 too complex)
|
||||
def _error_response(error_code):
|
||||
application.logger.exception('Admin app errored with %s', error_code)
|
||||
resp = make_response(render_template("error/{0}.html".format(error_code)), error_code)
|
||||
return useful_headers_after_request(resp)
|
||||
|
||||
@@ -469,19 +468,6 @@ def register_errorhandlers(application): # noqa (C901 too complex)
|
||||
def handle_no_permissions(error):
|
||||
return _error_response(401)
|
||||
|
||||
@application.errorhandler(500)
|
||||
def handle_exception(error):
|
||||
if current_app.config.get('DEBUG', None):
|
||||
raise error
|
||||
return _error_response(500)
|
||||
|
||||
@application.errorhandler(Exception)
|
||||
def handle_bad_request(error):
|
||||
# We want the Flask in browser stacktrace
|
||||
if current_app.config.get('DEBUG', None):
|
||||
raise error
|
||||
return _error_response(500)
|
||||
|
||||
@application.errorhandler(BadSignature)
|
||||
def handle_bad_token(error):
|
||||
# if someone has a malformed token
|
||||
@@ -509,6 +495,15 @@ def register_errorhandlers(application): # noqa (C901 too complex)
|
||||
), 400)
|
||||
return useful_headers_after_request(resp)
|
||||
|
||||
@application.errorhandler(500)
|
||||
@application.errorhandler(Exception)
|
||||
def handle_bad_request(error):
|
||||
current_app.logger.exception(error)
|
||||
# We want the Flask in browser stacktrace
|
||||
if current_app.config.get('DEBUG', None):
|
||||
raise error
|
||||
return _error_response(500)
|
||||
|
||||
|
||||
def setup_event_handlers():
|
||||
from flask_login import user_logged_in
|
||||
|
||||
Reference in New Issue
Block a user