errors

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 1 Imported by: 0

README

errors

import "github.com/gechr/x/errors"

Package errors provides helpers for working with errors.

Index

func IsAny

func IsAny(err error, targets ...error) bool

IsAny reports whether any error in targets matches err's error tree. Each target is compared using errors.Is.

Example
errNotFound := errors.New("not found")
errUnavailable := errors.New("unavailable")
err := fmt.Errorf("lookup: %w", errNotFound)

fmt.Println(xerrors.IsAny(err, errNotFound, errUnavailable))

Output:

true

Documentation

Overview

Package errors provides helpers for working with errors.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAny

func IsAny(err error, targets ...error) bool

IsAny reports whether any error in `targets` matches `err`'s error tree. Each target is compared using errors.Is.

Example
package main

import (
	"errors"
	"fmt"

	xerrors "github.com/gechr/x/errors"
)

func main() {
	errNotFound := errors.New("not found")
	errUnavailable := errors.New("unavailable")
	err := fmt.Errorf("lookup: %w", errNotFound)

	fmt.Println(xerrors.IsAny(err, errNotFound, errUnavailable))
}
Output:
true

Types

This section is empty.

Jump to

Keyboard shortcuts

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