ClassifyError maps a run error to the appropriate debug status. nil → StatusCompleted, context.Canceled → StatusInterrupted, everything else → StatusError. Callers with additional classification rules (e.g. ErrInterrupted, ErrDynamicToolCall) should handle those before falling back to this helper.
(err error)
| 659 | // classification rules (e.g. ErrInterrupted, ErrDynamicToolCall) |
| 660 | // should handle those before falling back to this helper. |
| 661 | func ClassifyError(err error) Status { |
| 662 | switch { |
| 663 | case err == nil: |
| 664 | return StatusCompleted |
| 665 | case errors.Is(err, context.Canceled): |
| 666 | return StatusInterrupted |
| 667 | default: |
| 668 | return StatusError |
| 669 | } |
| 670 | } |
| 671 | |
| 672 | func nullUUID(id uuid.UUID) uuid.NullUUID { |
| 673 | return uuid.NullUUID{UUID: id, Valid: id != uuid.Nil} |