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

Method Error

pkg/workflow/workflow_errors.go:163–185  ·  view source on GitHub ↗

Error implements the error interface

()

Source from the content-addressed store, hash-verified

161
162// Error implements the error interface
163func (e *ConfigurationError) Error() string {
164 var b strings.Builder
165
166 fmt.Fprintf(&b, "[%s] Configuration error in '%s'",
167 e.Timestamp.Format(time.RFC3339), e.ConfigKey)
168
169 if e.Value != "" {
170 // Truncate long values
171 truncatedValue := stringutil.Truncate(e.Value, 100)
172 fmt.Fprintf(&b, "\n\nValue: %s", truncatedValue)
173 }
174
175 fmt.Fprintf(&b, "\nReason: %s", e.Reason)
176
177 if e.Suggestion != "" {
178 fmt.Fprintf(&b, "\nSuggestion: %s", e.Suggestion)
179 } else {
180 // Provide default suggestion
181 fmt.Fprintf(&b, "\nSuggestion: Check the safe-outputs configuration in your workflow frontmatter and ensure '%s' is correctly specified.", e.ConfigKey)
182 }
183
184 return b.String()
185}
186
187// NewConfigurationError creates a new configuration error with context
188func NewConfigurationError(configKey, value, reason, suggestion string) *ConfigurationError {

Callers 1

TestConfigurationErrorFunction · 0.95

Calls 2

TruncateFunction · 0.92
StringMethod · 0.45

Tested by 1

TestConfigurationErrorFunction · 0.76