Skip to content

reedchan7/errx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

errx

errx is a more modern and convenient error handling library, providing more user-friendly stacktrace:

Install

go get github.com/reedchan7/errx

Quick Start

err := errx.New("oops: something wrong :(")
err = errx.Wrap(err, "failed to do something")
fmt.Printf("%+v\n", err)

Example

err := errx.NewInternalServerError().New("failed to do something")
err = errx.Wrap(err, "oops: :(")
err = errx.Wrapf(err, "xxxxxxx")
fmt.Printf("%+v\n", err)

Result:

500: Internal Server Error: xxxxxxx: oops: :(: failed to do something
  Thrown: failed to do something
    --- at /home/user/go/pkg/errx/errx_test.go:17 TestCode1()
  Thrown: oops: :(
    --- at /home/user/go/pkg/errx/errx_test.go:18 TestCode1()
  Thrown: xxxxxxx
    --- at /home/user/go/pkg/errx/errx_test.go:19 TestCode1()

About

errx is a simple and easy to use error handling library.

Topics

Resources

License

Stars

Watchers

Forks

Languages