errtag

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package errtag provides a way to add tags to errors.

Example
err := errbase.New("error")
err = Wrap(err, "foo", "bar")
tags := Get(err)
fmt.Println(tags["foo"])
Output:

bar

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func All added in v0.13.0

func All(err error) iter.Seq2[string, string]

All returns a iter.Seq2 of tags added to an error.

func Get

func Get(err error) map[string]string

Get returns the tags added to an error.

func Wrap

func Wrap(err error, key string, val string) error

Wrap adds a tag to an error.

Tags should be use for short and simple values, such as identifiers.

The verbose message is "tag <key> = <val>".

func WrapBool

func WrapBool(err error, key string, value bool) error

WrapBool is a helper for Wrap with bool value.

func WrapFloat64

func WrapFloat64(err error, key string, value float64) error

WrapFloat64 is a helper for Wrap with float64 value.

func WrapInt

func WrapInt(err error, key string, value int) error

WrapInt is a helper for Wrap with int value.

func WrapInt64

func WrapInt64(err error, key string, value int64) error

WrapInt64 is a helper for Wrap with int64 value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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