Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions pkg/workflow/workflow_errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ type ErrorCollector struct {
// NewErrorCollector creates a new error collector
// If failFast is true, the collector will stop at the first error
func NewErrorCollector(failFast bool) *ErrorCollector {
errorAggregationLog.Printf("Creating error collector: fail_fast=%v", failFast)
if errorAggregationLog.Enabled() {
errorAggregationLog.Printf("Creating error collector: fail_fast=%v", failFast)
}
return &ErrorCollector{
errors: make([]error, 0),
failFast: failFast,
Expand All @@ -208,10 +210,14 @@ func (c *ErrorCollector) Add(err error) error {
return nil
}

errorAggregationLog.Printf("Adding error to collector: %v", err)
if errorAggregationLog.Enabled() {
errorAggregationLog.Printf("Adding error to collector: %v", err)
}

if c.failFast {
errorAggregationLog.Print("Fail-fast enabled, returning error immediately")
if errorAggregationLog.Enabled() {
errorAggregationLog.Print("Fail-fast enabled, returning error immediately")
}
return err
}

Expand All @@ -231,7 +237,9 @@ func (c *ErrorCollector) Error() error {
return nil
}

errorAggregationLog.Printf("Aggregating %d errors", len(c.errors))
if errorAggregationLog.Enabled() {
errorAggregationLog.Printf("Aggregating %d errors", len(c.errors))
}

if len(c.errors) == 1 {
return c.errors[0]
Expand All @@ -248,7 +256,9 @@ func (c *ErrorCollector) FormattedError(category string) error {
return nil
}

errorAggregationLog.Printf("Formatting %d errors for category: %s", len(c.errors), category)
if errorAggregationLog.Enabled() {
errorAggregationLog.Printf("Formatting %d errors for category: %s", len(c.errors), category)
}

if len(c.errors) == 1 {
return c.errors[0]
Expand All @@ -271,7 +281,9 @@ type SharedWorkflowError struct {
// Error implements the error interface
// Returns a formatted info message explaining that this is a shared workflow
func (e *SharedWorkflowError) Error() string {
sharedWorkflowLog.Printf("Formatting info message for shared workflow: %s", e.Path)
if sharedWorkflowLog.Enabled() {
sharedWorkflowLog.Printf("Formatting info message for shared workflow: %s", e.Path)
}

filename := filepath.Base(e.Path)

Expand Down
Loading