Documentation
¶
Overview ¶
Package errorchain provides dependency-free helpers for inspecting Go error chains. The package is public so extensions can preserve bounded diagnostic evidence across the azd gRPC boundary without depending on internal APIs.
Index ¶
- Constants
- func CauseTypes(err error) []string
- func DeepestNamedType(err error) string
- func DeepestNamedTypeFromTypes(types []string) string
- func IsGenericWrapper(typeName string) bool
- func NormalizeCauseTypes(types []string) []string
- func SanitizeTypeName(name string) string
- func Types(err error) []string
Constants ¶
const MaxChainLen = 16
MaxChainLen caps the number of types collected from a single error chain. The cap bounds telemetry cardinality and protects traversal of pathological errors that unwrap to themselves.
Variables ¶
This section is empty.
Functions ¶
func CauseTypes ¶
CauseTypes returns a bounded, de-duplicated list of useful local error types for transport across an extension boundary. Generic wrappers are omitted; type names use the format produced by reflect.Type.String.
func DeepestNamedType ¶
DeepestNamedType returns the deepest non-generic type name from the chain, skipping wrappers that do not identify an origin. It falls back to the leaf type when every entry is generic and returns "<nil>" for a nil error.
func DeepestNamedTypeFromTypes ¶
DeepestNamedTypeFromTypes returns the deepest useful type from a previously captured cause-type list. It returns "<nil>" when no type is available.
func IsGenericWrapper ¶
IsGenericWrapper reports whether typeName is a generic chain or UX wrapper.
func NormalizeCauseTypes ¶
NormalizeCauseTypes bounds and de-duplicates diagnostic labels received from an extension. It returns a fresh slice and never includes generic wrappers. The normalized values remain extension-controlled and are not a privacy guarantee.
func SanitizeTypeName ¶
SanitizeTypeName converts a Go type name into a telemetry-safe segment.
Types ¶
This section is empty.