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:
parent
e5536ba384
commit
b4f84625bc
@ -83,6 +83,17 @@ def mainpage():
|
|||||||
response = static_html("start")
|
response = static_html("start")
|
||||||
return response
|
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(400)
|
||||||
@webserver.error(403)
|
@webserver.error(403)
|
||||||
@webserver.error(404)
|
@webserver.error(404)
|
||||||
@ -94,7 +105,7 @@ def customerror(error):
|
|||||||
code = int(str(error).split(",")[0][1:])
|
code = int(str(error).split(",")[0][1:])
|
||||||
|
|
||||||
template = jinja_environment.get_template('error.jinja')
|
template = jinja_environment.get_template('error.jinja')
|
||||||
res = template.render(errorcode=code)
|
res = template.render(errorcode=code,errordesc=errortypes[code])
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<h1>Error {{ errorcode }}</h1><br/>
|
<h1>Error {{ errorcode }}</h1><br/>
|
||||||
|
|
||||||
|
|
||||||
<p>That did not work. Don't ask me why.</p>
|
<p>{{ errordesc }}</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
Loading…
Reference in New Issue
Block a user