Skip to content

Commit

Permalink
Wrap errors from child workflow in canary sanity workflow (cadence-wo…
Browse files Browse the repository at this point in the history
…rkflow#6279)

* Wrap errors from child workflow in canary sanity workflow

What changed?
Wrap errors when joining Child Workflows and joined all errors to sanity error

Why?
Previously only the last error from the child workflows was being set to sanity error, and it was not clear if the error was from a child workflow or from sanity workflow.

How did you test it?

Potential risks

Release notes

Documentation Changes
  • Loading branch information
fimanishi authored Sep 12, 2024
1 parent 04add2d commit ef51975
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions canary/sanity.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
package canary

import (
"fmt"

"go.uber.org/cadence/workflow"
"go.uber.org/multierr"
"go.uber.org/zap"
)

Expand Down Expand Up @@ -94,6 +97,7 @@ func forkChildWorkflows(ctx workflow.Context, domain string, names []string) (wo
selector.AddFuture(future, func(f workflow.Future) {
if err := f.Get(ctx, nil); err != nil {
workflow.GetLogger(ctx).Error("child workflow failed", zap.Error(err))
err = fmt.Errorf("child workflow %s failed: %w", childName, err)
resultC.Send(ctx, err)
return
}
Expand All @@ -112,9 +116,7 @@ func joinChildWorkflows(ctx workflow.Context, names []string, selector workflow.
selector.Select(ctx)
var err1 error
resultC.Receive(ctx, &err1)
if err1 != nil {
err = err1
}
err = multierr.Append(err, err1)
}
return err
}
Expand Down

0 comments on commit ef51975

Please sign in to comment.