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

Method AsUpdateConflict

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

2540// carries them, or nil otherwise. Returns nil for any error other than
2541// "update_conflict" so callers can branch cleanly.
2542func (e *APIError) AsUpdateConflict() *UpdateConflictDetails {
2543 if e == nil || e.Code != "update_conflict" || len(e.Details) == 0 {
2544 return nil
2545 }
2546 var d UpdateConflictDetails
2547 if err := json.Unmarshal(e.Details, &d); err != nil {
2548 return nil
2549 }
2550 return &d
2551}
2552
2553// WriteUpdateConflictError formats an optimistic-concurrency conflict to w in
2554// the canonical two-track shape (TASK-2022), mirroring WriteOpenChildrenError

Callers 3

renderConflictFunction · 0.95
updateCmdFunction · 0.80
renderEditSaveErrorFunction · 0.80

Calls

no outgoing calls

Tested by 1

renderConflictFunction · 0.76