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

Function WritePlanLimitError

internal/cli/client.go:1256–1268  ·  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

1254// This mirrors WriteOpenChildrenError exactly in structure so the two paths
1255// are easy to reason about together.
1256func WritePlanLimitError(w io.Writer, apiErr *APIError) {
1257 envelope := map[string]any{
1258 "error": map[string]any{
1259 "code": apiErr.Code,
1260 "message": apiErr.Message,
1261 "details": apiErr.Details,
1262 },
1263 }
1264 if data, err := json.Marshal(envelope); err == nil {
1265 fmt.Fprintln(w, StructuredErrorMarker+string(data))
1266 }
1267 fmt.Fprintln(w, apiErr.Message)
1268}
1269
1270// --- Attachments ---
1271//

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