diff --git a/sdk/workflow/executor/executor.go b/sdk/workflow/executor/executor.go index e67dc65c..689602c3 100644 --- a/sdk/workflow/executor/executor.go +++ b/sdk/workflow/executor/executor.go @@ -210,12 +210,6 @@ func (e *WorkflowExecutor) getWorkflow(retry int, workflowId string, includeTask &client.WorkflowResourceApiGetExecutionStatusOpts{ IncludeTasks: optional.NewBool(includeTasks)}, ) - if response.StatusCode == 404 { - return nil, fmt.Errorf("no such workflow by Id %s", workflowId) - } - if response.StatusCode > 399 && response.StatusCode < 500 && response.StatusCode != 429 { - return nil, err - } if err != nil { if retry < 0 { return nil, err @@ -226,6 +220,12 @@ func (e *WorkflowExecutor) getWorkflow(retry int, workflowId string, includeTask } } + if response.StatusCode == 404 { + return nil, fmt.Errorf("no such workflow by Id %s", workflowId) + } + if response.StatusCode > 399 && response.StatusCode < 500 && response.StatusCode != 429 { + return nil, err + } return &workflow, err }