wrap

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: MIT Imports: 3 Imported by: 16

README

wrap

License Go Report Card Tests Codecov PkgGoDev Release GitHub go.mod Go version

Golang package to wrap things into a bit of context

Documentation

Overview

Package wrap contains code to simply wrap things into a bit of context.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error deprecated

func Error(err error, context string) error

Error creates an error with additional context

Deprecated: Use fmt.Errorf() instead using the `%w` format specifier.

func Errorf deprecated

func Errorf(err error, format string, a ...interface{}) error

Errorf creates an error with additional formatted context

Deprecated: Use fmt.Errorf() instead using the `%w` format specifier.

func Errors added in v1.1.0

func Errors(errs []error, context string) error

Errors creates a list of errors with additional context

func Errorsf added in v1.1.0

func Errorsf(errors []error, format string, a ...interface{}) error

Errorsf creates a list of errors with additional formatted context

Types

type ContextError

type ContextError interface {
	Context() string
	Cause() error
}

ContextError interface describes the simple type that is able to provide a textual context as well as the cause explaining the underlying error.

type ListOfErrors added in v1.1.0

type ListOfErrors interface {
	Context() string
	Errors() []error
}

ListOfErrors interface describes a list of errors with additional context information with an explanation.

Jump to

Keyboard shortcuts

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