Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
b9c3a3fc
Commit
b9c3a3fc
authored
Jul 21, 2019
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #652
parent
6d43e042
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
4 deletions
+45
-4
style.css
cps/static/css/style.css
+1
-0
http_error.html
cps/templates/http_error.html
+26
-2
web.py
cps/web.py
+18
-2
No files found.
cps/static/css/style.css
View file @
b9c3a3fc
...
@@ -141,6 +141,7 @@ input.pill:not(:checked) + label .glyphicon {
...
@@ -141,6 +141,7 @@ input.pill:not(:checked) + label .glyphicon {
.filterheader
{
margin-bottom
:
20px
;
}
.filterheader
{
margin-bottom
:
20px
;
}
.errorlink
{
margin-top
:
20px
;}
.modal-body
.comments
{
.modal-body
.comments
{
max-height
:
300px
;
max-height
:
300px
;
overflow-y
:
auto
;
overflow-y
:
auto
;
...
...
cps/templates/http_error.html
View file @
b9c3a3fc
...
@@ -17,10 +17,34 @@
...
@@ -17,10 +17,34 @@
{% endif %}
{% endif %}
</head>
</head>
<body>
<body>
<div
class=
"text-center"
>
<div
class=
"container-fluid"
>
<h1>
{{ error_code }}
</h1>
<div
class=
"row"
>
<div
class=
"col"
>
<h1
class=
"text-center"
>
{{ error_code }}
</h1>
<h3>
{{ error_name }}
</h3>
<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>
<a
href=
"{{url_for('web.index')}}"
title=
"{{ _('Back to home') }}"
>
{{_('Back to home')}}
</a>
</div>
</div>
</div>
</div>
</body>
</body>
</html>
</html>
cps/web.py
View file @
b9c3a3fc
...
@@ -27,6 +27,8 @@ import base64
...
@@ -27,6 +27,8 @@ import base64
import
datetime
import
datetime
import
json
import
json
import
mimetypes
import
mimetypes
import
traceback
import
sys
from
babel
import
Locale
as
LC
from
babel
import
Locale
as
LC
from
babel.dates
import
format_date
from
babel.dates
import
format_date
...
@@ -83,16 +85,30 @@ except ImportError:
...
@@ -83,16 +85,30 @@ except ImportError:
# custom error page
# custom error page
def
error_http
(
error
):
def
error_http
(
error
):
return
render_template
(
'http_error.html'
,
return
render_template
(
'http_error.html'
,
error_code
=
error
.
code
,
error_code
=
"Error {0}"
.
format
(
error
.
code
)
,
error_name
=
error
.
name
,
error_name
=
error
.
name
,
issue
=
False
,
instance
=
config
.
config_calibre_web_title
instance
=
config
.
config_calibre_web_title
),
error
.
code
),
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
# http error handling
for
ex
in
default_exceptions
:
for
ex
in
default_exceptions
:
# new routine for all client errors, server errors stay
if
ex
<
500
:
if
ex
<
500
:
app
.
register_error_handler
(
ex
,
error_http
)
app
.
register_error_handler
(
ex
,
error_http
)
elif
ex
==
500
:
app
.
register_error_handler
(
ex
,
internal_error
)
web
=
Blueprint
(
'web'
,
__name__
)
web
=
Blueprint
(
'web'
,
__name__
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment