diff --git a/dapr/ext/workflow/dapr_workflow_client.py b/dapr/ext/workflow/dapr_workflow_client.py index 96a8d9c33..975c5c292 100644 --- a/dapr/ext/workflow/dapr_workflow_client.py +++ b/dapr/ext/workflow/dapr_workflow_client.py @@ -189,7 +189,7 @@ def get_workflow_state( ) return WorkflowState(state) if state else None except RpcError as error: - if 'no such instance exists' in error.details(): + if error.details() and 'no such instance exists' in error.details(): self._logger.warning(f'Workflow instance not found: {instance_id}') return None self._logger.error( diff --git a/tests/ext/workflow/test_workflow_client.py b/tests/ext/workflow/test_workflow_client.py index c19eb6a74..10461c4b6 100644 --- a/tests/ext/workflow/test_workflow_client.py +++ b/tests/ext/workflow/test_workflow_client.py @@ -77,6 +77,8 @@ def get_orchestration_state(self, instance_id, fetch_payloads, app_id=None): return self._inner_get_orchestration_state( instance_id, client.OrchestrationStatus.PENDING ) + elif wf_status == 'no-details': + raise SimulatedRpcError(code='UNAVAILABLE', details=None) else: raise SimulatedRpcError(code='UNKNOWN', details='unknown error') @@ -274,6 +276,10 @@ def test_client_functions(self): assert actual_get_result is None + wf_status = 'no-details' + with self.assertRaises(RpcError): + wfClient.get_workflow_state(instance_id=mock_instance_id, fetch_payloads=True) + wf_status = 'found' actual_get_result = wfClient.get_workflow_state( instance_id=mock_instance_id, fetch_payloads=True