aboutsummaryrefslogtreecommitdiffstats
path: root/pysite/views
diff options
context:
space:
mode:
authorGravatar Gareth Coles <[email protected]>2018-02-18 17:28:10 +0000
committerGravatar Gareth Coles <[email protected]>2018-02-18 17:28:10 +0000
commit06792bdd9252bb09ace98513e4cd4f4b7e3bdd01 (patch)
treeb2c7515bfb684b06509346f4056e72ca72d472e3 /pysite/views
parentRegister error routes on the app instead of specific blueprints #1rcht (diff)
Error handlers can now handle more than one HTTP status code
Diffstat (limited to 'pysite/views')
-rw-r--r--pysite/views/main/error_handlers/http_5xx.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/pysite/views/main/error_handlers/http_5xx.py b/pysite/views/main/error_handlers/http_5xx.py
new file mode 100644
index 00000000..ed4d8d82
--- /dev/null
+++ b/pysite/views/main/error_handlers/http_5xx.py
@@ -0,0 +1,12 @@
+# coding=utf-8
+from werkzeug.exceptions import HTTPException
+
+from pysite.base_route import ErrorView
+
+
+class Error404View(ErrorView):
+ name = "error_5xx"
+ error_code = range(500, 600)
+
+ def get(self, error: HTTPException):
+ return "Internal server error. Please try again later!", error.code