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

Added descriptions for HTTP errors

This commit is contained in:
Krateng 2020-08-31 04:36:39 +02:00
parent e5536ba384
commit b4f84625bc
2 changed files with 13 additions and 2 deletions

View File

@ -83,6 +83,17 @@ def mainpage():
response = static_html("start")
return response
errortypes = {
400: "Bad Request",
403: "Forbidden",
404: "Not Found",
405: "Method Not Allowed",
408: "Request Timeout",
418: "I'm a teapot",
500: "Internal Server Error",
505: "HTTP Version Not Supported"
}
@webserver.error(400)
@webserver.error(403)
@webserver.error(404)
@ -94,7 +105,7 @@ def customerror(error):
code = int(str(error).split(",")[0][1:])
template = jinja_environment.get_template('error.jinja')
res = template.render(errorcode=code)
res = template.render(errorcode=code,errordesc=errortypes[code])
return res

View File

@ -11,7 +11,7 @@
<h1>Error {{ errorcode }}</h1><br/>
<p>That did not work. Don't ask me why.</p>
<p>{{ errordesc }}</p>
</td>
</tr>
</table>