errs

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package errs provides error handling utilities that extend Go's standard "errors" library.

It offers:

  • UnwrapDeep: recursively unwraps error chains until the root/deepest error is reached.

Usage:

import "github.com/amberpixels/k1/errs"

// Get the root cause of a wrapped error chain
rootErr := errs.UnwrapDeep(wrappedError)

// Example with error wrapping:
err1 := errors.New("root cause")
err2 := fmt.Errorf("layer 2: %w", err1)
err3 := fmt.Errorf("layer 3: %w", err2)
root := errs.UnwrapDeep(err3) // returns err1

Package errs is intended as a lightweight helper for deep error chain traversal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnwrapDeep

func UnwrapDeep(err error) error

UnwrapDeep recursively unwraps an error chain until it reaches the deepest/root error. It returns the root cause of the error chain, or nil if the input is nil.

Example:

err1 := errors.New("database connection failed")
err2 := fmt.Errorf("query failed: %w", err1)
err3 := fmt.Errorf("operation failed: %w", err2)
root := errs.UnwrapDeep(err3) // returns err1

Types

This section is empty.

Jump to

Keyboard shortcuts

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