Documentation
¶
Overview ¶
Package errchain provides low-level, dependency-free helpers for inspecting Go error chains. It is intentionally separate from the classifier in internal/cmd so telemetry sub-spans in low-level packages can emit chain context without pulling in the full typed classifier graph.
Index ¶
Constants ¶
const MaxChainLen = 16
MaxChainLen caps the number of types collected from a single error chain. The cap is global to bound telemetry cardinality and to stop pathological errors that unwrap to themselves.
Variables ¶
This section is empty.
Functions ¶
func DeepestNamedType ¶
DeepestNamedType returns the deepest non-generic type name from the chain, skipping the wrappers in genericWrappers so a fmt.Errorf or suggestion wrap doesn't mask the real error. Falls back to the leaf type when nothing in the chain is non-generic. Returns "<nil>" for a nil error.
func IsGenericWrapper ¶
IsGenericWrapper reports whether the given Go type name (as produced by reflect.TypeOf(err).String()) is a generic chain wrapper. Exposed so the typed classifier in internal/cmd can apply the same logic when picking a fallback ResultCode.
func SanitizeTypeName ¶
SanitizeTypeName converts a Go type name (e.g. "*azcore.ResponseError") into a telemetry-safe segment ("azcore_ResponseError").
func Types ¶
Types returns the wrapped-error type chain (outermost first) as a slice of Go type names (e.g. "*fmt.wrapError", "*azcore.ResponseError"). The traversal:
- follows Unwrap() error linearly,
- depth-first walks Unwrap() []error in slice order,
- skips nil children,
- is globally capped at MaxChainLen.
Returns nil for a nil error.
Types ¶
This section is empty.