errors

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 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 errors provides a multi-error that is aware of the source location it was created.

Index

Constants

This section is empty.

Variables

View Source
var ProjectRoot = ``

ProjectRoot is used to trim paths in verbose output. Anything in the path up to, and including ProjectRoot will be removed from the front of the output paths.

View Source
var Verbose = false

Verbose is used to control verbose output. When true, error messages will include the caller's location.

Functions

func Message

func Message(template string, params ...any) string

Message returns a message formatted according to the given template and parameters.

func New

func New(template string, params ...any) error

New returns an error formatted according to the given template and parameters.

func Panic

func Panic(template string, params ...any)

Panic panics with a message formatted the way an error returned from this package would be.

func ToStrings

func ToStrings(errors ...error) []string

ToStrings takes a slice of errors and converts it to a slice of strings.

func Unwrap

func Unwrap(err error) []error

Unwrap takes an error, which can be a single error or a multi-error, and unwraps it into a flat slice of errors.

func Wrap

func Wrap(cause error, template string, params ...any) error

Wrap returns an error formatted according to the given template and parameters with the given error as its cause.

func WrapAll

func WrapAll(causes []error, template string, params ...any) error

WrapAll returns an error formatted according to the given template and parameters with the given errors as its cause.

func WrapMessage

func WrapMessage(cause error, template string, params ...any) string

WrapMessage returns a message formatted according to the given template and parameters with the given error as its cause.

Types

This section is empty.

Jump to

Keyboard shortcuts

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