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

Function ClassifyError

pkg/telemetry/mcp/span.go:236–247  ·  view source on GitHub ↗

ClassifyError maps an MCP error to a low-cardinality error.type value. MCP errors are often plain RPC errors; this helper picks reasonable labels for cancellation and falls back to the type name otherwise.

(err error)

Source from the content-addressed store, hash-verified

234// MCP errors are often plain RPC errors; this helper picks reasonable
235// labels for cancellation and falls back to the type name otherwise.
236func ClassifyError(err error) string {
237 if err == nil {
238 return ""
239 }
240 switch {
241 case errors.Is(err, context.Canceled):
242 return "context_canceled"
243 case errors.Is(err, context.DeadlineExceeded):
244 return "deadline_exceeded"
245 }
246 return "rpc_error"
247}

Callers 2

TestClassifyErrorFunction · 0.70
RecordErrorMethod · 0.70

Calls

no outgoing calls

Tested by 1

TestClassifyErrorFunction · 0.56