Skip to content

objenious/errors

This branch is 9 commits ahead of, 8 commits behind pkg/errors:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Baptiste Boussemart
Sep 19, 2019
0ea2606 · Sep 19, 2019
Dec 27, 2015
Sep 10, 2019
Jun 27, 2016
Sep 10, 2019
Sep 11, 2019
Sep 10, 2019
Sep 10, 2019
Sep 11, 2019
Sep 11, 2019
Sep 11, 2019
Sep 10, 2019
Sep 10, 2019
Sep 10, 2019
Sep 11, 2019

Repository files navigation

errors for go 1.13 and beyond Travis-CI AppVeyor GoDoc Report card Sourcegraph

Package errors provides simple error handling primitives, compatible with Go 1.13 error wrapping.

go get github.com/objenious/errors

The traditional error handling idiom in Go is roughly akin to

if err != nil {
        return err
}

which applied recursively up the call stack results in error reports without context or debugging information. The errors package allows programmers to add context to the failure path in their code in a way that does not destroy the original value of the error.

Adding context to an error

The errors.Wrap function returns a new error that adds context to the original error. For example

_, err := ioutil.ReadAll(r)
if err != nil {
        return errors.Wrap(err, "read failed")
}

Read the package documentation for more information.

License

BSD-2-Clause

Packages

No packages published

Languages

  • Go 97.4%
  • Makefile 2.6%