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.
()
| 2418 | // APIError carries them, or nil otherwise. Returns nil for any error |
| 2419 | // other than "open_children" so callers can branch cleanly. |
| 2420 | func (e *APIError) AsOpenChildren() *OpenChildrenDetails { |
| 2421 | if e == nil || e.Code != "open_children" || len(e.Details) == 0 { |
| 2422 | return nil |
| 2423 | } |
| 2424 | var d OpenChildrenDetails |
| 2425 | if err := json.Unmarshal(e.Details, &d); err != nil { |
| 2426 | return nil |
| 2427 | } |
| 2428 | return &d |
| 2429 | } |
| 2430 | |
| 2431 | // StructuredErrorMarker is the versioned line prefix the CLI writes |
| 2432 | // to stderr when surfacing a structured error (currently: IDEA-1494's |
no outgoing calls