1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Improved error handling and output

This commit is contained in:
krateng 2021-12-09 06:26:06 +01:00
parent 83063ba943
commit e901ca719f
2 changed files with 16 additions and 14 deletions

View File

@ -117,17 +117,19 @@ def clean_html(inp):
@webserver.error(503)
@webserver.error(505)
def customerror(error):
errorcode = error.status_code
errordesc = error.status
traceback = error.traceback or error.body
error_code = error.status_code
error_desc = error.status
traceback = error.traceback
body = error.body or ""
traceback = traceback.strip() if traceback is not None else "No Traceback"
adminmode = request.cookies.get("adminmode") == "true" and auth.check(request)
template = jinja_environment.get_template('error.jinja')
return template.render(
errorcode=errorcode,
errordesc=errordesc,
error_code=error_code,
error_desc=error_desc,
traceback=traceback,
error_full_desc=body,
adminmode=adminmode,
)
@ -345,14 +347,13 @@ def unregister_temp_endpoint():
def wait_for_db():
register_endpoints_web_static()
register_temp_endpoint()
database.start_db()
register_endpoints_api()
register_endpoints_web_dynamic()
unregister_temp_endpoint()
database.start_db()
def run_server():

View File

@ -8,7 +8,8 @@
<div style="background-image:url('/favicon.png')"></div>
</td>
<td class="text">
<h1>{{ errordesc }}</h1><br/>
<h1>{{ error_desc }}</h1><br/>
{{ error_full_desc }}
</td>
</tr>
@ -23,7 +24,7 @@
{{ traceback }}
{%- endautoescape %}</div>
{% else %}
A team of Korean schoolgirls with katanas has been dispatched to deal with this situation.
Kazuma, Aqua, Darkness and Megumin have been dispatched to deal with this situation.
{% endif %}