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.
()
| 2851 | // carries them, or nil otherwise. Returns nil for any error other than |
| 2852 | // "update_conflict" so callers can branch cleanly. |
| 2853 | func (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 |
no outgoing calls