From 0ae4448fbe837faa6722c6d444de9fde979822f8 Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Mon, 4 Jan 2021 13:48:34 -0500 Subject: [PATCH] Fixed ApiError call. Now includes task_id and task_name. --- crc/services/workflow_service.py | 4 +++- tests/workflow/test_workflow_form_field_type.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crc/services/workflow_service.py b/crc/services/workflow_service.py index a30622a2..e9aec982 100644 --- a/crc/services/workflow_service.py +++ b/crc/services/workflow_service.py @@ -130,7 +130,9 @@ class WorkflowService(object): # Assure we have a field type if field.type is None: raise ApiError(code='invalid_form_data', - message='Field type is None. A field type must be provided.') + message=f'Type is missing for field "{field.id}". A field type must be provided.', + task_id=task.id, + task_name=task.get_name()) # Assure field has valid properties WorkflowService.check_field_properties(field, task) diff --git a/tests/workflow/test_workflow_form_field_type.py b/tests/workflow/test_workflow_form_field_type.py index 406d2669..48ec6533 100644 --- a/tests/workflow/test_workflow_form_field_type.py +++ b/tests/workflow/test_workflow_form_field_type.py @@ -10,5 +10,5 @@ class TestFormFieldType(BaseTest): json_data = json.loads(rv.get_data(as_text=True)) self.assertEqual(json_data[0]['message'], - 'When populating all fields ... Field type is None. A field type must be provided.') + 'When populating all fields ... Type is missing for field "name". A field type must be provided.') # print('TestFormFieldType: Good Form')