(args []string, err error)
| 199 | } |
| 200 | |
| 201 | func 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 | |
| 224 | func marshalDiagnosticExecutionError(args []string, err error) ([]byte, bool) { |
| 225 | item, ok := diagnosticspkg.ItemFromError(err) |
no test coverage detected