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

Function MarshalErrorJSONL

internal/agentidentity/errors.go:151–163  ·  view source on GitHub ↗

MarshalErrorJSONL renders one stable JSONL error frame for agent CLI streaming commands.

(err error)

Source from the content-addressed store, hash-verified

149
150// MarshalErrorJSONL renders one stable JSONL error frame for agent CLI streaming commands.
151func MarshalErrorJSONL(err error) ([]byte, error) {
152 frame, marshalErr := json.Marshal(struct {
153 Type string `json:"type"`
154 Error ErrorPayload `json:"error"`
155 }{
156 Type: "error",
157 Error: ErrorPayloadFor(err),
158 })
159 if marshalErr != nil {
160 return nil, marshalErr
161 }
162 return append(frame, '\n'), nil
163}
164
165// ExitCodeForError maps agent identity and command errors to deterministic CLI exit codes.
166func ExitCodeForError(err error) int {

Calls 2

ErrorPayloadForFunction · 0.85
appendFunction · 0.85