diff --git a/game.py b/game.py index b6d329a..685d758 100755 --- a/game.py +++ b/game.py @@ -69,6 +69,15 @@ def page_not_found(e): desc = config.get('i18n', 'desc') return render_template('404.html', title=title, lang=lang, desc=desc, theme=theme, url=url), 404 +@app.errorhandler(500) +def internal_server_error(e): + lang = config.get('i18n', 'lang') + title = config.get('i18n', 'title') + url = config.get('main', 'base_url') + theme = config.get('main', 'theme') + desc = config.get('i18n', 'desc') + return render_template('500.html', title=title, lang=lang, desc=desc, theme=theme, url=url), 500 + @app.route("/") def hello(): lang = config.get('i18n', 'lang') @@ -113,6 +122,7 @@ def getContent(): return result app.register_error_handler(404, page_not_found) +app.register_error_handler(500, internal_server_error) if __name__ == "__main__": from waitress import serve diff --git a/templates/404.html b/templates/404.html index b9984ac..63f694d 100644 --- a/templates/404.html +++ b/templates/404.html @@ -3,7 +3,7 @@ {% block main %}
Sorry, the page you requested does not exists.
[Home]
Sorry, the page you requested caused an internal server error.
+[Home]
+