Skip to content

t11e/prettyerr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

prettyerr Build Status GoDoc Report card

Adds pretty error printing to the errors created by github.com/pkg/errors.

Usage

Minimal:

fmt.Printf("something went wrong:\n%s\n",
    prettyerr.Format{err})

With options:

fmt.Printf("something went wrong:\n%s\n",
    prettyerr.Format{
        Err: err,
        Flags: prettyerr.FlagTesting,
        Prefix: "TEST: ",
    })

Example output:

problem polishing widget: ran out of polish
Caused by: ran out of polish
    at github.com/t11e/prettyerr_test.ExampleFormat ($GOPATH/src/github.com/t11e/prettyerr/prettyerr_test.go)
    at testing.runExample ($GOROOT/src/testing/example.go)
    at testing.runExamples ($GOROOT/src/testing/example.go)
    at testing.(*M).Run ($GOROOT/src/testing/testing.go)
    at main.main (github.com/t11e/prettyerr/_test/_testmain.go)

Read the package documentation for more information.

Contributions

Clone this repository into your GOPATH and use dep to install its dependencies.

brew install dep
go get github.com/t11e/prettyerr
cd "$GOPATH"/src/github.com/t11e/prettyerr
dep ensure

You can then run the tests:

go test $(go list ./... | grep -v /vendor/)

License

MIT. See LICENSE file.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages