mirror of
https://github.com/janeczku/calibre-web
synced 2025-01-05 06:50:30 +00:00
Improved handling of docker database errors
This commit is contained in:
parent
812265324d
commit
881b48729c
@ -37,17 +37,31 @@ def error_http(error):
|
|||||||
error_code="Error {0}".format(error.code),
|
error_code="Error {0}".format(error.code),
|
||||||
error_name=error.name,
|
error_name=error.name,
|
||||||
issue=False,
|
issue=False,
|
||||||
|
goto_admin=False,
|
||||||
unconfigured=not config.db_configured,
|
unconfigured=not config.db_configured,
|
||||||
instance=config.config_calibre_web_title
|
instance=config.config_calibre_web_title
|
||||||
), error.code
|
), error.code
|
||||||
|
|
||||||
|
|
||||||
def internal_error(error):
|
def internal_error(error):
|
||||||
|
if (isinstance(error.original_exception, AttributeError) and
|
||||||
|
error.original_exception.args[0] == "'NoneType' object has no attribute 'query'"
|
||||||
|
and error.original_exception.name == "query"):
|
||||||
|
return render_template('http_error.html',
|
||||||
|
error_code="Database Error",
|
||||||
|
error_name='The library used is invalid or has permission errors',
|
||||||
|
issue=False,
|
||||||
|
goto_admin=True,
|
||||||
|
unconfigured=False,
|
||||||
|
error_stack="",
|
||||||
|
instance=config.config_calibre_web_title
|
||||||
|
), 500
|
||||||
return render_template('http_error.html',
|
return render_template('http_error.html',
|
||||||
error_code="500 Internal Server Error",
|
error_code="500 Internal Server Error",
|
||||||
error_name='The server encountered an internal error and was unable to complete your '
|
error_name='The server encountered an internal error and was unable to complete your '
|
||||||
'request. There is an error in the application.',
|
'request. There is an error in the application.',
|
||||||
issue=True,
|
issue=True,
|
||||||
|
goto_admin=False,
|
||||||
unconfigured=False,
|
unconfigured=False,
|
||||||
error_stack=traceback.format_exc().split("\n"),
|
error_stack=traceback.format_exc().split("\n"),
|
||||||
instance=config.config_calibre_web_title
|
instance=config.config_calibre_web_title
|
||||||
|
@ -48,7 +48,11 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col errorlink">
|
<div class="col errorlink">
|
||||||
{% if not unconfigured %}
|
{% if not unconfigured %}
|
||||||
<a href="{{url_for('web.index')}}" title="{{ _('Return to Home') }}">{{_('Return to Home')}}</a>
|
{% if goto_admin %}
|
||||||
|
<a href="{{url_for('admin.db_configuration')}}" title="{{ _('Return to Database config') }}">{{_('Return to Database config')}}</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="{{url_for('web.index')}}" title="{{ _('Return to Home') }}">{{_('Return to Home')}}</a>
|
||||||
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="{{url_for('web.logout')}}" title="{{ _('Logout User') }}">{{ _('Logout User') }}</a>
|
<a href="{{url_for('web.logout')}}" title="{{ _('Logout User') }}">{{ _('Logout User') }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
Reference in New Issue
Block a user