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

Method AsPlanLimit

internal/cli/client.go:1284–1293  ·  view source on GitHub ↗

AsPlanLimit returns the parsed plan-limit details when this APIError carries them, or nil otherwise. Returns nil for any error other than "plan_limit_exceeded" so callers can branch cleanly.

()

Source from the content-addressed store, hash-verified

1282// carries them, or nil otherwise. Returns nil for any error other than
1283// "plan_limit_exceeded" so callers can branch cleanly.
1284func (e *APIError) AsPlanLimit() *PlanLimitDetails {
1285 if e == nil || e.Code != "plan_limit_exceeded" || len(e.Details) == 0 {
1286 return nil
1287 }
1288 var d PlanLimitDetails
1289 if err := json.Unmarshal(e.Details, &d); err != nil {
1290 return nil
1291 }
1292 return &d
1293}
1294
1295// WritePlanLimitError formats a plan-limit rejection to w in the canonical
1296// two-track shape (TASK-788):

Callers 5

inviteCmdFunction · 0.80
workspaceCreateCmdFunction · 0.80
libraryActivateCmdFunction · 0.80
webhooksCreateCmdFunction · 0.80
createCmdFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected