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

Method AsUpdateConflict

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

2851// carries them, or nil otherwise. Returns nil for any error other than
2852// "update_conflict" so callers can branch cleanly.
2853func (e *APIError) AsUpdateConflict() *UpdateConflictDetails {
2854 if e == nil || e.Code != "update_conflict" || len(e.Details) == 0 {
2855 return nil
2856 }
2857 var d UpdateConflictDetails
2858 if err := json.Unmarshal(e.Details, &d); err != nil {
2859 return nil
2860 }
2861 return &d
2862}
2863
2864// WriteUpdateConflictError formats an optimistic-concurrency conflict to w in
2865// the canonical two-track shape (TASK-2022), mirroring WriteOpenChildrenError

Callers 4

renderConflictFunction · 0.95
needsNotMineOneFunction · 0.80
updateCmdFunction · 0.80
renderEditSaveErrorFunction · 0.80

Calls

no outgoing calls

Tested by 1

renderConflictFunction · 0.76