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