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.
()
| 1091 | // APIError carries them, or nil otherwise. Returns nil for any error |
| 1092 | // other than "open_children" so callers can branch cleanly. |
| 1093 | func (e *APIError) AsOpenChildren() *OpenChildrenDetails { |
| 1094 | if e == nil || e.Code != "open_children" || len(e.Details) == 0 { |
| 1095 | return nil |
| 1096 | } |
| 1097 | var d OpenChildrenDetails |
| 1098 | if err := json.Unmarshal(e.Details, &d); err != nil { |
| 1099 | return nil |
| 1100 | } |
| 1101 | return &d |
| 1102 | } |
| 1103 | |
| 1104 | // StructuredErrorMarker is the versioned line prefix the CLI writes |
| 1105 | // to stderr when surfacing a structured error (currently: IDEA-1494's |
no outgoing calls
no test coverage detected