aboutsummaryrefslogtreecommitdiff
path: root/app/views/tasks.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/tasks.py')
-rw-r--r--app/views/tasks.py10
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,