AsOpenChildren returns the parsed open-children details when this APIError carries them, or nil otherwise. Returns nil for any error other than "open_children" so callers can branch cleanly.
()
| 2729 | // APIError carries them, or nil otherwise. Returns nil for any error |
| 2730 | // other than "open_children" so callers can branch cleanly. |
| 2731 | func (e *APIError) AsOpenChildren() *OpenChildrenDetails { |
| 2732 | if e == nil || e.Code != "open_children" || len(e.Details) == 0 { |
| 2733 | return nil |
| 2734 | } |
| 2735 | var d OpenChildrenDetails |
| 2736 | if err := json.Unmarshal(e.Details, &d); err != nil { |
| 2737 | return nil |
| 2738 | } |
| 2739 | return &d |
| 2740 | } |
| 2741 | |
| 2742 | // StructuredErrorMarker is the versioned line prefix the CLI writes |
| 2743 | // to stderr when surfacing a structured error (currently: IDEA-1494's |
no outgoing calls