MCPcopy Create free account
hub / github.com/github/gh-aw / FormattedError

Method FormattedError

pkg/workflow/workflow_errors.go:270–285  ·  view source on GitHub ↗

FormattedError returns the aggregated error with a formatted header showing the count Returns nil if no errors were collected This method is preferred over Error() + FormatAggregatedError for better accuracy

(category string)

Source from the content-addressed store, hash-verified

268// Returns nil if no errors were collected
269// This method is preferred over Error() + FormatAggregatedError for better accuracy
270func (c *ErrorCollector) FormattedError(category string) error {
271 if len(c.errors) == 0 {
272 return nil
273 }
274
275 if errorAggregationLog.Enabled() {
276 errorAggregationLog.Printf("Formatting %d errors for category: %s", len(c.errors), category)
277 }
278
279 if len(c.errors) == 1 {
280 return c.errors[0]
281 }
282
283 header := fmt.Sprintf("Found %d %s errors:", len(c.errors), category)
284 return fmt.Errorf("%s\n%w", header, errors.Join(c.errors...))
285}
286
287var sharedWorkflowLog = logger.New("workflow:shared_workflow_error")
288

Calls 3

EnabledMethod · 0.45
PrintfMethod · 0.45
ErrorfMethod · 0.45