MCPcopy Index your code
hub / github.com/docker/docker-agent / OverflowKindOf

Function OverflowKindOf

pkg/modelerrors/modelerrors.go:200–217  ·  view source on GitHub ↗

OverflowKindOf returns the [OverflowKind] of err, or "" if it isn't an overflow error. If err is already wrapped in a [*ContextOverflowError] with a non-empty Kind, that Kind is returned; otherwise classification runs on the unwrapped error.

(err error)

Source from the content-addressed store, hash-verified

198// with a non-empty Kind, that Kind is returned; otherwise classification
199// runs on the unwrapped error.
200func OverflowKindOf(err error) OverflowKind {
201 if err == nil {
202 return ""
203 }
204 if coe, ok := errors.AsType[*ContextOverflowError](err); ok {
205 if coe.Kind != "" {
206 return coe.Kind
207 }
208 // Legacy wrap with no Kind — try classifying the underlying.
209 if coe.Underlying != nil {
210 if k := classifyOverflow(coe.Underlying); k != "" {
211 return k
212 }
213 }
214 return OverflowKindTokens
215 }
216 return classifyOverflow(err)
217}
218
219// classifyOverflow inspects err for overflow signals and returns the matching
220// [OverflowKind], or "" if err is not an overflow error.

Callers 3

classifyErrorCodeFunction · 0.92
TestOverflowKindOfFunction · 0.85
FormatErrorFunction · 0.85

Calls 1

classifyOverflowFunction · 0.85

Tested by 1

TestOverflowKindOfFunction · 0.68