Skip to content

Commit 65903f7

Browse files
Add workflow already completed error to client (#1081)
1 parent 57463a9 commit 65903f7

File tree

5 files changed

+9
-1
lines changed

5 files changed

+9
-1
lines changed

client/client.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ type (
134134
// The errors it can return:
135135
// - EntityNotExistsError
136136
// - InternalServiceError
137+
// - WorkflowExecutionAlreadyCompletedError
137138
SignalWorkflow(ctx context.Context, workflowID string, runID string, signalName string, arg interface{}) error
138139

139140
// SignalWithStartWorkflow sends a signal to a running workflow.
@@ -154,6 +155,7 @@ type (
154155
// - EntityNotExistsError
155156
// - BadRequestError
156157
// - InternalServiceError
158+
// - WorkflowExecutionAlreadyCompletedError
157159
CancelWorkflow(ctx context.Context, workflowID string, runID string) error
158160

159161
// TerminateWorkflow terminates a workflow execution.
@@ -164,6 +166,7 @@ type (
164166
// - EntityNotExistsError
165167
// - BadRequestError
166168
// - InternalServiceError
169+
// - WorkflowExecutionAlreadyCompletedError
167170
TerminateWorkflow(ctx context.Context, workflowID string, runID string, reason string, details []byte) error
168171

169172
// GetWorkflowHistory gets history events of a particular workflow

internal/client.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ type (
114114
// The errors it can return:
115115
// - EntityNotExistsError
116116
// - InternalServiceError
117+
// - WorkflowExecutionAlreadyCompletedError
117118
SignalWorkflow(ctx context.Context, workflowID string, runID string, signalName string, arg interface{}) error
118119

119120
// SignalWithStartWorkflow sends a signal to a running workflow.
@@ -136,6 +137,7 @@ type (
136137
// - EntityNotExistsError
137138
// - BadRequestError
138139
// - InternalServiceError
140+
// - WorkflowExecutionAlreadyCompletedError
139141
CancelWorkflow(ctx context.Context, workflowID string, runID string) error
140142

141143
// TerminateWorkflow terminates a workflow execution.
@@ -146,6 +148,7 @@ type (
146148
// - EntityNotExistsError
147149
// - BadRequestError
148150
// - InternalServiceError
151+
// - WorkflowExecutionAlreadyCompletedError
149152
TerminateWorkflow(ctx context.Context, workflowID string, runID string, reason string, details []byte) error
150153

151154
// GetWorkflowHistory gets history events of a particular workflow

internal/common/metrics/service_wrapper.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ func (s *operationScope) handleError(err error) {
121121
*shared.BadRequestError,
122122
*shared.DomainAlreadyExistsError,
123123
*shared.WorkflowExecutionAlreadyStartedError,
124+
*shared.WorkflowExecutionAlreadyCompletedError,
124125
*shared.QueryFailedError:
125126
s.scope.Counter(CadenceInvalidRequest).Inc(1)
126127
default:

internal/internal_retry.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ func isServiceTransientError(err error) bool {
6767
case *s.BadRequestError,
6868
*s.EntityNotExistsError,
6969
*s.WorkflowExecutionAlreadyStartedError,
70+
*s.WorkflowExecutionAlreadyCompletedError,
7071
*s.DomainAlreadyExistsError,
7172
*s.QueryFailedError,
7273
*s.DomainNotActiveError,

internal/internal_workflow_testsuite.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2027,7 +2027,7 @@ func (env *testWorkflowEnvironmentImpl) signalWorkflowByID(workflowID, signalNam
20272027

20282028
if workflowHandle, ok := env.runningWorkflows[workflowID]; ok {
20292029
if workflowHandle.handled {
2030-
return &shared.EntityNotExistsError{Message: fmt.Sprintf("Workflow %v already completed", workflowID)}
2030+
return &shared.WorkflowExecutionAlreadyCompletedError{Message: fmt.Sprintf("Workflow %v already completed", workflowID)}
20312031
}
20322032
workflowHandle.env.postCallback(func() {
20332033
workflowHandle.env.signalHandler(signalName, data)

0 commit comments

Comments
 (0)