err
github.com/alexkappa/errors
go get github.com/alexkappa/errors
err

github.com/alexkappa/errors

Similar to standard library errors but with some stack trace goodness

by Alex Kalyvitis

v0.0.0-20170804121356-ebbb2e5061e9 (see all)License:MIT
go get github.com/alexkappa/errors
Readme

errors GoDoc

Similar to standard library errors but with some stack trace goodness.

Usage

err := errors.New("whoops!") // looks familiar?

You can even wrap an error to provide context.

_, err := w.Write(p)
if err != nil {
    err = errors.Wrap(err, "Example failed")
}
fmt.Println(err) // Example failed. write error [github.com/alexkappa/errors.Wrap(errors.go:76),github.com/alexkappa/errors.ExampleWrap(errors_test.go:56),testing.runExample(example.go:99),testing.RunExamples(example.go:36),testing.(*M).Run(testing.go:486),main.main(_testmain.go:58)]

You can also access the stack trace and print it out yourself.

err := errors.New("error with stack trace")
for _, frame := range err.Stack() {
    fmt.Printf("%s\n", frame.Func)
}
// github.com/alexkappa/errors.New
// main.main

GitHub Stars

11

LAST COMMIT

5yrs ago

MAINTAINERS

0

CONTRIBUTORS

1

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
v0.0.0-20160125122255-1d151215dfb3
1yr ago
v0.0.0-20170804121356-ebbb2e5061e9
2yrs ago
v0.0.0-20170404145210-cfcf53fa50d5
2yrs ago
No alternatives found
No tutorials found
Add a tutorial