MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / WritePlanLimitError

Function WritePlanLimitError

internal/cli/client.go:1305–1317  ·  view source on GitHub ↗

WritePlanLimitError formats a plan-limit rejection to w in the canonical two-track shape (TASK-788): 1. A single `pad-structured-error/v1: {json}\n` marker line — consumed by the MCP stdio classifier so it lifts the structured payload instead of falling through to a generic server_error. 2. A human

(w io.Writer, apiErr *APIError)

Source from the content-addressed store, hash-verified

1303// This mirrors WriteOpenChildrenError exactly in structure so the two paths
1304// are easy to reason about together.
1305func WritePlanLimitError(w io.Writer, apiErr *APIError) {
1306 envelope := map[string]any{
1307 "error": map[string]any{
1308 "code": apiErr.Code,
1309 "message": apiErr.Message,
1310 "details": apiErr.Details,
1311 },
1312 }
1313 if data, err := json.Marshal(envelope); err == nil {
1314 fmt.Fprintln(w, StructuredErrorMarker+string(data))
1315 }
1316 fmt.Fprintln(w, apiErr.Message)
1317}
1318
1319// --- Attachments ---
1320//

Callers 5

inviteCmdFunction · 0.92
workspaceCreateCmdFunction · 0.92
libraryActivateCmdFunction · 0.92
webhooksCreateCmdFunction · 0.92
createCmdFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected