MCPcopy Index your code
hub / github.com/github/gh-aw / Error

Method Error

pkg/workflow/workflow_errors.go:108–130  ·  view source on GitHub ↗

Error implements the error interface

()

Source from the content-addressed store, hash-verified

106
107// Error implements the error interface
108func (e *OperationError) Error() string {
109 var b strings.Builder
110
111 fmt.Fprintf(&b, "[%s] Failed to %s %s",
112 e.Timestamp.Format(time.RFC3339), e.Operation, e.EntityType)
113
114 if e.EntityID != "" {
115 fmt.Fprintf(&b, " #%s", e.EntityID)
116 }
117
118 if e.Cause != nil {
119 fmt.Fprintf(&b, "\n\nUnderlying error: %v", e.Cause)
120 }
121
122 if e.Suggestion != "" {
123 fmt.Fprintf(&b, "\nSuggestion: %s", e.Suggestion)
124 } else {
125 // Provide default suggestion
126 fmt.Fprintf(&b, "\nSuggestion: Check that the %s exists and you have the necessary permissions.", e.EntityType)
127 }
128
129 return b.String()
130}
131
132// Unwrap returns the underlying error
133func (e *OperationError) Unwrap() error {

Calls 1

StringMethod · 0.45