Fix rendering of task errors

This commit is contained in:
rubenwardy 2024-03-27 17:55:51 +00:00
parent 6b9614314c
commit f9048a8f49
2 changed files with 5 additions and 2 deletions

@ -55,7 +55,10 @@ def check(id):
if current_user.is_authenticated and current_user.rank.at_least(UserRank.ADMIN): if current_user.is_authenticated and current_user.rank.at_least(UserRank.ADMIN):
info["error"] = str(traceback) info["error"] = str(traceback)
elif str(result)[1:12] == "TaskError: ": elif str(result)[1:12] == "TaskError: ":
info["error"] = str(result)[12:-1] if hasattr(result, "value"):
info["error"] = result.value
else:
info["error"] = str(result)
else: else:
info["error"] = "Unknown server error" info["error"] = "Unknown server error"
else: else:

@ -12,7 +12,7 @@
<h1>{{ self.title() }}</h1> <h1>{{ self.title() }}</h1>
{% if "error" in info or info.status == "FAILURE" or info.status == "REVOKED" %} {% if "error" in info or info.status == "FAILURE" or info.status == "REVOKED" %}
<pre>{{ info.error }}</pre> <pre style="white-space: pre-wrap; word-wrap: break-word;">{{ info.error }}</pre>
{% else %} {% else %}
<script src="/static/js/polltask.js"></script> <script src="/static/js/polltask.js"></script>
<script> <script>