File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222from flask_limiter import RateLimitExceeded
2323from flask_babel import gettext as _
2424from werkzeug .exceptions import default_exceptions
25+
26+ from .cw_login import current_user
2527try :
2628 from werkzeug .exceptions import FailedDependency
2729except ImportError :
@@ -62,14 +64,21 @@ def internal_error(error):
6264 error_stack = "" ,
6365 instance = config .config_calibre_web_title
6466 ), 500
67+ log .error ("500 Internal Server Error: %s" , traceback .format_exc ())
68+ error_stack = ""
69+ try :
70+ if current_user .is_authenticated and current_user .role_admin ():
71+ error_stack = traceback .format_exc ().split ("\n " )
72+ except Exception :
73+ pass
6574 return render_template ('http_error.html' ,
6675 error_code = "500 Internal Server Error" ,
6776 error_name = 'The server encountered an internal error and was unable to complete your '
6877 'request. There is an error in the application.' ,
6978 issue = True ,
7079 goto_admin = False ,
7180 unconfigured = False ,
72- error_stack = traceback . format_exc (). split ( " \n " ) ,
81+ error_stack = error_stack ,
7382 instance = config .config_calibre_web_title
7483 ), 500
7584
You can’t perform that action at this time.
0 commit comments