This commit is contained in:
2026-04-26 14:04:24 +03:00
parent 9a10f30634
commit 10ea1f03cd
3 changed files with 18 additions and 1 deletions

View File

@@ -319,6 +319,15 @@ def create_app():
return {'error': 'not found'}, e.code
else:
return render_template('common/404.html'), e.code
@app.errorhandler(403)
def _handle_403(e):
if request.path.startswith('/hyperapi/'):
return '<h1>forbiddedn</h1>', e.code
elif request.path.startswith('/api/'):
return {'error': 'forbidden'}, e.code
else:
return render_template('common/403.html'), e.code
#
# @app.errorhandler(413)
# def _handle_413(e):

View File

@@ -0,0 +1,8 @@
{%- from 'common/macros.html' import subheader -%}
{%- extends 'base.html' -%}
{%- block title -%}Forbidden{%- endblock -%}
{%- block content -%}
{%- call() subheader('403 Forbidden') -%}
<span>You are not allowed to access this page or perform this action.</span>
{%- endcall -%}
{%- endblock -%}

View File

@@ -3,6 +3,6 @@
{%- block title -%}Not found{%- endblock -%}
{%- block content -%}
{%- call() subheader('404 Not Found') -%}
<span>The requested URL was not found.</span>
<span>The requested page was not found.</span>
{%- endcall -%}
{%- endblock -%}