mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-24 18:47:23 +00:00
Fix #652
This commit is contained in:
parent
6d43e0422a
commit
b9c3a3fcea
@ -141,6 +141,7 @@ input.pill:not(:checked) + label .glyphicon {
|
||||
|
||||
.filterheader { margin-bottom: 20px; }
|
||||
|
||||
.errorlink {margin-top: 20px;}
|
||||
.modal-body .comments {
|
||||
max-height:300px;
|
||||
overflow-y: auto;
|
||||
|
@ -17,10 +17,34 @@
|
||||
{% endif %}
|
||||
</head>
|
||||
<body>
|
||||
<div class="text-center">
|
||||
<h1>{{ error_code }}</h1>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h1 class="text-center">{{ error_code }}</h1>
|
||||
<h3>{{ error_name }}</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-offset-4 text-left">
|
||||
{% for element in error_stack %}
|
||||
<div>{{ element }}</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% if issue %}
|
||||
<div class="row">
|
||||
<div class="col errorlink">Please report this issue with all related information:
|
||||
<a href="https://github.com/janeczku/calibre-web/issues/new">{{_('Create issue')}}</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col errorlink">
|
||||
<a href="{{url_for('web.index')}}" title="{{ _('Back to home') }}">{{_('Back to home')}}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
20
cps/web.py
20
cps/web.py
@ -27,6 +27,8 @@ import base64
|
||||
import datetime
|
||||
import json
|
||||
import mimetypes
|
||||
import traceback
|
||||
import sys
|
||||
|
||||
from babel import Locale as LC
|
||||
from babel.dates import format_date
|
||||
@ -83,16 +85,30 @@ except ImportError:
|
||||
# custom error page
|
||||
def error_http(error):
|
||||
return render_template('http_error.html',
|
||||
error_code=error.code,
|
||||
error_code="Error {0}".format(error.code),
|
||||
error_name=error.name,
|
||||
issue=False,
|
||||
instance=config.config_calibre_web_title
|
||||
), error.code
|
||||
|
||||
|
||||
def internal_error(error):
|
||||
__, __, tb = sys.exc_info()
|
||||
return render_template('http_error.html',
|
||||
error_code="Internal Server Error",
|
||||
error_name=str(error),
|
||||
issue=True,
|
||||
error_stack=traceback.format_tb(tb),
|
||||
instance=config.config_calibre_web_title
|
||||
), 500
|
||||
|
||||
|
||||
# http error handling
|
||||
for ex in default_exceptions:
|
||||
# new routine for all client errors, server errors stay
|
||||
if ex < 500:
|
||||
app.register_error_handler(ex, error_http)
|
||||
elif ex == 500:
|
||||
app.register_error_handler(ex, internal_error)
|
||||
|
||||
|
||||
web = Blueprint('web', __name__)
|
||||
|
Loading…
Reference in New Issue
Block a user