MCPcopy Create free account
hub / github.com/compozy/agh / writeExecutionError

Function writeExecutionError

internal/cli/root.go:186–199  ·  view source on GitHub ↗
(stderr io.Writer, args []string, err error)

Source from the content-addressed store, hash-verified

184}
185
186func writeExecutionError(stderr io.Writer, args []string, err error) int {
187 exitCode := cliExitCodeForError(err)
188 if payload, ok := marshalStructuredExecutionError(args, err); ok {
189 if _, writeErr := stderr.Write(payload); writeErr == nil {
190 if len(payload) == 0 || payload[len(payload)-1] != '\n' {
191 _, _ = fmt.Fprintln(stderr)
192 }
193 return exitCode
194 }
195 }
196
197 _, _ = fmt.Fprintf(stderr, "error: %v\n", err)
198 return exitCode
199}
200
201func marshalStructuredExecutionError(args []string, err error) ([]byte, bool) {
202 if !isStructuredAgentCommandError(err) {

Callers 2

ExecuteContextFunction · 0.85

Calls 3

cliExitCodeForErrorFunction · 0.85
WriteMethod · 0.65

Tested by 1