errorgraph

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package errorgraph bounds framework-owned inspection of wrapped/joined errors. Callers isolate custom Is/As/Unwrap methods and retain callback ownership.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As

func As[T error](err error) (value T, found, complete bool)

As returns the first assignable/custom-As match in depth-first order. Complete distinguishes an absent match from an exhausted traversal. A found value ends the search before unwrapping it, including when the matched value is typed nil.

func AsShallow

func AsShallow[T error](err error) (T, bool)

AsShallow performs the assignability/custom-As step of errors.As without unwrapping. T must implement error. Use inside Walk to bound the whole search.

func AsTarget

func AsTarget(err error, target any) bool

AsTarget is the bounded errors.As search for a dynamic, validated target.

func AsTargetShallow

func AsTargetShallow(err error, target any) bool

AsTargetShallow performs one assignability/custom-As step for a validated errors.As target. Framework adapters may expose only their current node while their bounded children retain the caller's shared traversal and pruning rules.

func Has

func Has[T error](err error) bool

Has searches for an assignable/custom-As match within Walk's shared bounds. An incomplete search establishes no match.

func Is

func Is(err, target error) bool

Is searches for equality or a custom Is match within Walk's shared bounds. Exhaustion means no match was established. Callers retain isolation and must treat an unmatched non-nil error as a failure, not evidence of successful work.

func Matches

func Matches(err, target error) bool

Matches performs the equality/custom-Is step of errors.Is without unwrapping. Use inside Walk to retain one shared traversal budget across classifications.

func Walk

func Walk(err error, visit func(error) bool) bool

Walk visits non-nil errors in depth-first order. A false visitor result stops successfully. False means traversal exceeded its node/depth bounds. A callback must return; this bounds graph traversal, not arbitrary work inside methods.

func WalkPruned

func WalkPruned(err error, visit func(error) bool, prune func(error) bool) bool

WalkPruned omits a pruned node and its descendants while keeping the shared traversal budget and depth-first sibling precedence.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL