diff --git a/temporal/error.go b/temporal/error.go index 7801e2250..b3aba9d0c 100644 --- a/temporal/error.go +++ b/temporal/error.go @@ -210,12 +210,12 @@ func IsApplicationError(err error) bool { return errors.As(err, &applicationError) } -// IsWorkflowExecutionAlreadyStartedError return if the err is a -// WorkflowExecutionAlreadyStartedError or if an error in the chain is a -// ChildWorkflowExecutionAlreadyStartedError. +// IsWorkflowExecutionAlreadyStartedError returns true if an error in the chain +// is a WorkflowExecutionAlreadyStartedError or ChildWorkflowExecutionAlreadyStartedError. func IsWorkflowExecutionAlreadyStartedError(err error) bool { - if _, ok := err.(*serviceerror.WorkflowExecutionAlreadyStarted); ok { - return ok + var alreadyStartedError *serviceerror.WorkflowExecutionAlreadyStarted + if errors.As(err, &alreadyStartedError) { + return true } var childError *ChildWorkflowExecutionAlreadyStartedError return errors.As(err, &childError)