Merge branch 'dev' into bug/missing_pi_name_246

This commit is contained in:
Dan 2021-08-17 09:47:09 -04:00
commit 77de2a8f47
2 changed files with 9 additions and 10 deletions

View File

@ -51,7 +51,15 @@ class ApiError(Exception):
if "task" in task.data:
task.data.pop("task")
# In the unlikely event that the API error can't be serialized, try removing the task_data, as it may
# contain some invalid data that we can't return, so we can at least get the erro rmessage.
instance.task_data = task.data
try:
json.dumps(instance)
except TypeError as te:
instance.task_data = {
'task_data_hidden': 'We were unable to serialize the task data when reporting this error'}
app.logger.error(message, exc_info=True)
return instance
@ -90,15 +98,6 @@ class ApiErrorSchema(ma.Schema):
@app.errorhandler(ApiError)
def handle_invalid_usage(error):
response = ApiErrorSchema().dump(error)
# In the unlikely event that the API error can't be serialized, try removing the task_data, as it may
# contain some invalid data that we can't return, so we can at least get the erro rmessage.
try:
json_output = json.dumps(response)
except TypeError as te:
error.task_data = {'task_data_hidden':'We were unable to serialize the task data when reporting this error'}
response = ApiErrorSchema().dump(error)
return response, error.status_code

View File

@ -329,7 +329,7 @@ class WorkflowService(object):
# Then you must evaluate the expression based on the data within the group, if that data exists.
# There may not be data available in the group, if no groups where added
group = field.get_property(Task.FIELD_PROP_REPEAT)
if group in task.data:
if group in task.data and len(task.data[group]) > 0:
# Here we must make the current group data top level (as it would be in a repeat section) but
# make all other top level task data available as well.
new_data = copy.deepcopy(task.data)