Skip to content

Commit

Permalink
chore: wrap errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rangoo94 committed Jul 25, 2024
1 parent c956772 commit 96aacdf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/testworkflows/testworkflowprocessor/action/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import (
"fmt"
"strings"

"github.com/pkg/errors"

"github.com/kubeshop/testkube/internal/common"
"github.com/kubeshop/testkube/pkg/expressions"
"github.com/kubeshop/testkube/pkg/testworkflows/testworkflowprocessor/action/actiontypes"
"github.com/kubeshop/testkube/pkg/testworkflows/testworkflowprocessor/action/actiontypes/lite"
stage2 "github.com/kubeshop/testkube/pkg/testworkflows/testworkflowprocessor/stage"
)

// TODO: Wrap all errors in this file
func process(currentStatus string, parents []string, stage stage2.Stage, machines ...expressions.Machine) (actions []actiontypes.Action, err error) {
// Store the init status
actions = append(actions, actiontypes.Action{
Expand Down Expand Up @@ -96,7 +97,7 @@ func process(currentStatus string, parents []string, stage stage2.Stage, machine
for _, ch := range group.Children() {
sub, err := process(currentStatus, parents, ch, machines...)
if err != nil {
return nil, err
return nil, errors.Wrap(err, "processing group children")
}
if !ch.Optional() {
currentStatus = fmt.Sprintf("%s && %s", ch.Ref(), currentStatus)
Expand Down Expand Up @@ -144,7 +145,7 @@ func Process(root stage2.Stage, machines ...expressions.Machine) ([]actiontypes.
actions, err = optimize(actions)
if err != nil || len(actions) == prevLength {
sort(actions)
return actions, err
return actions, errors.Wrap(err, "processing operations")
}
}
}

0 comments on commit 96aacdf

Please sign in to comment.