mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Improved error page
This commit is contained in:
parent
d85d13ce5a
commit
363c431b93
@ -83,17 +83,6 @@ 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)
|
||||||
@ -102,10 +91,14 @@ errortypes = {
|
|||||||
@webserver.error(500)
|
@webserver.error(500)
|
||||||
@webserver.error(505)
|
@webserver.error(505)
|
||||||
def customerror(error):
|
def customerror(error):
|
||||||
code = int(str(error).split(",")[0][1:])
|
errorcode = error.status_code
|
||||||
|
errordesc = error.status
|
||||||
|
traceback = error.traceback.strip()
|
||||||
|
|
||||||
|
adminmode = request.cookies.get("adminmode") == "true" and auth.check(request)
|
||||||
|
|
||||||
template = jinja_environment.get_template('error.jinja')
|
template = jinja_environment.get_template('error.jinja')
|
||||||
res = template.render(errorcode=code,errordesc=errortypes[code])
|
res = template.render(errorcode=errorcode,errordesc=errordesc,traceback=traceback,adminmode=adminmode)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,6 +69,7 @@
|
|||||||
<tr> <td>artist</td> <td><i>Artist String</i></td> </tr>
|
<tr> <td>artist</td> <td><i>Artist String</i></td> </tr>
|
||||||
<tr> <td>title</td> <td><i>Title String</i></td> </tr>
|
<tr> <td>title</td> <td><i>Title String</i></td> </tr>
|
||||||
<tr> <td>key</td> <td><i>API Key</i></td> </tr>
|
<tr> <td>key</td> <td><i>API Key</i></td> </tr>
|
||||||
|
<tr> <td>time</td> <td><i>UNIX timestamp - optional, defaults to time of request</i></td> </tr>
|
||||||
<tr> <td>seconds</td> <td><i>Duration of Scrobble - optional and currently not used</i></td> </tr>
|
<tr> <td>seconds</td> <td><i>Duration of Scrobble - optional and currently not used</i></td> </tr>
|
||||||
</table>
|
</table>
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
|
@ -8,12 +8,21 @@
|
|||||||
<div style="background-image:url('/favicon.png')"></div>
|
<div style="background-image:url('/favicon.png')"></div>
|
||||||
</td>
|
</td>
|
||||||
<td class="text">
|
<td class="text">
|
||||||
<h1>Error {{ errorcode }}</h1><br/>
|
<h1>{{ errordesc }}</h1><br/>
|
||||||
|
|
||||||
|
|
||||||
<p>{{ errordesc }}</p>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{% if adminmode %}
|
||||||
|
You are only seeing this information because you are in admin mode:
|
||||||
|
<br/><br/>
|
||||||
|
<div style="white-space: pre-wrap; font-family: monospace;">{{ traceback }}</div>
|
||||||
|
{% else %}
|
||||||
|
A team of Korean schoolgirls with katanas has been dispatched to deal with this situation.
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user