diff options
author | rubenwardy <rw@rubenwardy.com> | 2018-05-14 01:20:02 +0100 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2018-05-14 01:20:02 +0100 |
commit | e6a3836aab3e16dd2201136d0112d92f0b3356d6 (patch) | |
tree | 68dbf52c63588304a260ff6fc0911604d23856dd /app/views/tasks.py | |
parent | 73fa5d11866e1ab36463c3a773b8ca0d3671a709 (diff) | |
download | cheatdb-e6a3836aab3e16dd2201136d0112d92f0b3356d6.tar.xz |
Hide all non-TaskError exceptions from users
Diffstat (limited to 'app/views/tasks.py')
-rw-r--r-- | app/views/tasks.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/views/tasks.py b/app/views/tasks.py index e6a5dc4..58d6d25 100644 --- a/app/views/tasks.py +++ b/app/views/tasks.py @@ -3,7 +3,7 @@ from flask_user import * from flask.ext import menu from app import app, csrf from app.models import * -from app.tasks import celery +from app.tasks import celery, TaskError from app.tasks.importtasks import getMeta from .utils import shouldReturnJson # from celery.result import AsyncResult @@ -33,8 +33,14 @@ def check_task(id): info = { 'id': id, 'status': status, - 'error': str(result), } + + if current_user.is_authenticated and current_user.rank.atLeast(UserRank.ADMIN): + info["error"] = str(traceback) + elif str(result)[1:12] == "TaskError: ": + info["error"] = str(result)[12:-1] + else: + info["error"] = "Unknown server error" else: info = { 'id': id, |