xerrors

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MPL-2.0 Imports: 2 Imported by: 10 modules, 10 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package xerrors contains the additions to std errors package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTagged

func NewTagged[T Tag](err error) error

NewTagged creates a new typed error.

func NewTaggedf

func NewTaggedf[T Tag](format string, a ...any) error

NewTaggedf creates a new typed error.

func TagIs

func TagIs[T Tag](err error) bool

TagIs is wrapper around errors.As which checks the error tag.

func TypeIs

func TypeIs[T error](err error) bool

TypeIs is wrapper around errors.As which check the error type.

Types

type Tag

type Tag interface {
	~struct{}
}

Tag is a type which can be used to tag Tagged errors.

type Tagged

type Tagged[T Tag] struct {
	// contains filtered or unexported fields
}

Tagged is an error with a tag attached. Tag can only be an empty struct.

func (*Tagged[T]) Error

func (e *Tagged[T]) Error() string

Error implements error interface.

func (*Tagged[T]) Unwrap

func (e *Tagged[T]) Unwrap() error

Unwrap implements errors.Unwrap.

Jump to

Keyboard shortcuts

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