Improve error handling for settings. Instead of failing with an exception, an alert is displayed on the main page when something isn't set properly.

This commit is contained in:
2018-11-09 13:40:48 +02:00
parent f3814ec281
commit 0a2d62b001
7 changed files with 112 additions and 31 deletions

View File

@ -24,6 +24,8 @@
</div>
</div>
{% include 'YtManagerApp/index_errors_banner.html' %}
<div class="row">
<div class="col-3">

View File

@ -0,0 +1,24 @@
{% if config_errors %}
<div class="alert alert-danger alert-card mx-auto">
<p>Attention! Some critical configuration errors have been found!</p>
<ul>
{% for err in config_errors %}
<li>{{ err }}</li>
{% endfor %}
</ul>
<p>Until these problems are fixed, the server may have encounter serious problems while running.
Please correct these errors, and then restart the server.</p>
</div>
{% endif %}
{% if config_warnings %}
<div class="alert alert-warning alert-card mx-auto">
<p>Warning: some configuration problems have been found!</p>
<ul>
{% for err in config_warnings %}
<li>{{ err }}</li>
{% endfor %}
</ul>
<p>We recommend that you fix these issues before continuing.</p>
</div>
{% endif %}

View File

@ -3,6 +3,8 @@
{% block body %}
{% include 'YtManagerApp/index_errors_banner.html' %}
<h1>Hello</h1>
<h2>Please log in to continue</h2>