log errors in error handlers

This commit is contained in:
dandds 2018-08-09 11:48:33 -04:00 committed by luis cielak
parent 3fa4adb4de
commit c98e57f17c
2 changed files with 5 additions and 1 deletions

View File

@ -27,4 +27,6 @@ class UnauthorizedError(Exception):
class UnauthenticatedError(Exception):
pass
@property
def message(self):
return str(self)

View File

@ -8,12 +8,14 @@ def make_error_pages(app):
@app.errorhandler(exceptions.UnauthorizedError)
# pylint: disable=unused-variable
def not_found(e):
app.logger.error(e.message)
return render_template("not_found.html"), 404
@app.errorhandler(exceptions.UnauthenticatedError)
# pylint: disable=unused-variable
def unauthorized(e):
app.logger.error(e.message)
return render_template('unauthorized.html'), 401
return app