Fixed broken error handling for long-running tasks

This commit is contained in:
Joel Collins 2019-01-28 17:49:44 +00:00
parent e3a27b024a
commit a11d2145d9
5 changed files with 45 additions and 4 deletions

View file

@ -1,6 +1,8 @@
from threading import Thread
from functools import wraps
import datetime
import logging
import traceback
import time
import uuid
@ -111,7 +113,9 @@ class Task:
r = f(*args, **kwargs)
s = 'success'
except Exception as e:
r = e
logging.error(e)
logging.error(traceback.format_exc())
r = str(e)
s = 'error'
self.state['return'] = r
self.state['status'] = s