Skip to content

Commit

Permalink
[Wf-Diagnostics] add timeout error to failures
Browse files Browse the repository at this point in the history
  • Loading branch information
sankari165 committed Oct 9, 2024
1 parent 74ec9b1 commit 5a8d0b4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions service/worker/diagnostics/invariant/failure/failure.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ func errorTypeFromReason(reason string) ErrorType {
if strings.Contains(reason, "Panic") {
return PanicError
}
if strings.Contains(reason, "Timeout") {
return TimeoutError
}
return CustomError
}

Expand Down
4 changes: 2 additions & 2 deletions service/worker/diagnostics/invariant/failure/failure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func Test__Check(t *testing.T) {
},
{
InvariantType: WorkflowFailed.String(),
Reason: CustomError.String(),
Reason: TimeoutError.String(),
Metadata: metadataInBytes,
},
},
Expand Down Expand Up @@ -123,7 +123,7 @@ func failedWfHistory() *types.GetWorkflowExecutionHistoryResponse {
},
{
WorkflowExecutionFailedEventAttributes: &types.WorkflowExecutionFailedEventAttributes{
Reason: common.StringPtr("custom error"),
Reason: common.StringPtr("cadenceInternal:Timeout START_TO_CLOSE"),
Details: []byte("test-activity-failure"),
DecisionTaskCompletedEventID: 10,
},
Expand Down
1 change: 1 addition & 0 deletions service/worker/diagnostics/invariant/failure/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const (
CustomError ErrorType = "The failure is caused by a specific custom error returned from the service code"
GenericError ErrorType = "The failure is because of an error returned from the service code"
PanicError ErrorType = "The failure is caused by a panic in the service code"
TimeoutError ErrorType = "The failure is caused by a timeout during the execution"
)

func (e ErrorType) String() string {
Expand Down

0 comments on commit 5a8d0b4

Please sign in to comment.