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,7 @@
import pprint
import logging
import copy
from werkzeug.exceptions import BadRequest
class JsonPayload:
def __init__(self, request):
@ -8,7 +9,11 @@ class JsonPayload:
Object to wrap up simple functionality for parsing a JSON response.
"""
# Try to load as json
self.json = request.get_json() #: dict: Dictionary representation of request JSON
try:
self.json = request.get_json() #: dict: Dictionary representation of request JSON
except BadRequest as e:
logging.error(e)
self.json = {}
if self.json is None:
self.json = {}

View file

@ -43,6 +43,8 @@ class TaskListAPI(MicroscopeView):
:>header Content-Type: application/json
"""
print(self.microscope.task.state)
data = self.microscope.task.state
return jsonify(data)