Skip to content

Commit

Permalink
Update app.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sondregronas committed Aug 1, 2024
1 parent fe55d4e commit fcfa98c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions BookingSystem/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,17 @@ def unauthorized_403(_) -> tuple[flask.Response, int]:

@app.errorhandler(404)
def page_not_found(_) -> tuple[str, int]:
logger.warning(f'A user tried to access a non-existing page: {flask.request.url}')
return flask.render_template('404.html'), 404

@app.errorhandler(418)
def teapot(_) -> tuple[flask.Response, int]:
logger.warning(f'A user fell victim to the teapot at {flask.request.url}')
return flask.redirect('https://www.youtube.com/watch?v=dQw4w9WgXcQ'), 302

@app.errorhandler(500)
def internal_server_error(_) -> tuple[str, int]:
logger.error(f'An internal server error occurred at {flask.request.url}')
return flask.render_template('500.html'), 500

@app.route('/robots.txt')
Expand Down

0 comments on commit fcfa98c

Please sign in to comment.