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

Method AsUpdateConflict

internal/cli/client.go:1186–1195  ·  view source on GitHub ↗

AsUpdateConflict returns the parsed conflict details when this APIError carries them, or nil otherwise. Returns nil for any error other than "update_conflict" so callers can branch cleanly.

()

Source from the content-addressed store, hash-verified

1184// carries them, or nil otherwise. Returns nil for any error other than
1185// "update_conflict" so callers can branch cleanly.
1186func (e *APIError) AsUpdateConflict() *UpdateConflictDetails {
1187 if e == nil || e.Code != "update_conflict" || len(e.Details) == 0 {
1188 return nil
1189 }
1190 var d UpdateConflictDetails
1191 if err := json.Unmarshal(e.Details, &d); err != nil {
1192 return nil
1193 }
1194 return &d
1195}
1196
1197// WriteUpdateConflictError formats an optimistic-concurrency conflict to w in
1198// the canonical two-track shape (TASK-2022), mirroring WriteOpenChildrenError

Callers 1

updateCmdFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected