diff options
Diffstat (limited to 'pysite/views/error_handlers')
| -rw-r--r-- | pysite/views/error_handlers/http_404.py | 12 | ||||
| -rw-r--r-- | pysite/views/error_handlers/http_5xx.py | 12 |
2 files changed, 24 insertions, 0 deletions
diff --git a/pysite/views/error_handlers/http_404.py b/pysite/views/error_handlers/http_404.py new file mode 100644 index 00000000..1d557d9b --- /dev/null +++ b/pysite/views/error_handlers/http_404.py @@ -0,0 +1,12 @@ +# coding=utf-8 +from werkzeug.exceptions import NotFound + +from pysite.base_route import ErrorView + + +class Error404View(ErrorView): + name = "error_404" + error_code = 404 + + def get(self, error: NotFound): + return "replace me with a template, 404 not found", 404 diff --git a/pysite/views/error_handlers/http_5xx.py b/pysite/views/error_handlers/http_5xx.py new file mode 100644 index 00000000..ed4d8d82 --- /dev/null +++ b/pysite/views/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 |