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.
()
| 1140 | // APIError carries them, or nil otherwise. Returns nil for any error |
| 1141 | // other than "open_children" so callers can branch cleanly. |
| 1142 | func (e *APIError) AsOpenChildren() *OpenChildrenDetails { |
| 1143 | if e == nil || e.Code != "open_children" || len(e.Details) == 0 { |
| 1144 | return nil |
| 1145 | } |
| 1146 | var d OpenChildrenDetails |
| 1147 | if err := json.Unmarshal(e.Details, &d); err != nil { |
| 1148 | return nil |
| 1149 | } |
| 1150 | return &d |
| 1151 | } |
| 1152 | |
| 1153 | // StructuredErrorMarker is the versioned line prefix the CLI writes |
| 1154 | // to stderr when surfacing a structured error (currently: IDEA-1494's |
no outgoing calls
no test coverage detected