NewContextOverflowError creates a ContextOverflowError wrapping the given underlying error. The Kind is inferred from the underlying error via [classifyOverflow]; if classification yields no result, Kind defaults to [OverflowKindTokens] (the historical behaviour). Use this constructor rather than bu
(underlying error)
| 116 | // rather than building the struct directly so future field additions don't |
| 117 | // break callers. |
| 118 | func NewContextOverflowError(underlying error) *ContextOverflowError { |
| 119 | kind := classifyOverflow(underlying) |
| 120 | if kind == "" { |
| 121 | kind = OverflowKindTokens |
| 122 | } |
| 123 | return &ContextOverflowError{Underlying: underlying, Kind: kind} |
| 124 | } |
| 125 | |
| 126 | func (e *ContextOverflowError) Error() string { |
| 127 | if e.Underlying == nil { |