parseToolResultRows decodes persisted tool result rows.
(raw pqtype.NullRawMessage)
| 566 | |
| 567 | // parseToolResultRows decodes persisted tool result rows. |
| 568 | func parseToolResultRows(raw pqtype.NullRawMessage) ([]toolResultRaw, error) { |
| 569 | if !raw.Valid || len(raw.RawMessage) == 0 { |
| 570 | return nil, nil |
| 571 | } |
| 572 | |
| 573 | var rows []toolResultRaw |
| 574 | if err := json.Unmarshal(raw.RawMessage, &rows); err != nil { |
| 575 | return nil, xerrors.Errorf("parse tool content: %w", err) |
| 576 | } |
| 577 | return rows, nil |
| 578 | } |
| 579 | |
| 580 | // extractErrorString pulls the "error" field from a JSON object if |
| 581 | // present, returning it as a string. Returns "" if the field is |
no test coverage detected