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

Function marshalStructuredExecutionError

internal/cli/root.go:201–222  ·  view source on GitHub ↗
(args []string, err error)

Source from the content-addressed store, hash-verified

199}
200
201func marshalStructuredExecutionError(args []string, err error) ([]byte, bool) {
202 if !isStructuredAgentCommandError(err) {
203 return marshalDiagnosticExecutionError(args, err)
204 }
205
206 switch requestedOutputFormat(args) {
207 case OutputJSON:
208 payload, marshalErr := agentidentity.MarshalErrorJSON(err)
209 if marshalErr != nil {
210 return nil, false
211 }
212 return payload, true
213 case OutputJSONL:
214 payload, marshalErr := agentidentity.MarshalErrorJSONL(err)
215 if marshalErr != nil {
216 return nil, false
217 }
218 return payload, true
219 default:
220 return nil, false
221 }
222}
223
224func marshalDiagnosticExecutionError(args []string, err error) ([]byte, bool) {
225 item, ok := diagnosticspkg.ItemFromError(err)

Callers 1

writeExecutionErrorFunction · 0.85

Calls 5

MarshalErrorJSONFunction · 0.92
MarshalErrorJSONLFunction · 0.92
requestedOutputFormatFunction · 0.85

Tested by

no test coverage detected