Skip to content

cristalhq/errorx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

errorx

build-img pkg-img version-img

TODO

Rationale

TODO

Features

  • Simple and easy.
  • Safe & fast.
  • Tested.
  • Dependency-free.

See these docs or GUIDE.md for more details.

Install

Go version 1.18+

go get github.com/cristalhq/errorx

Example

err := errorx.Newf("this is the error")
if err != nil {
	return errorx.Wrapf(err, "something happened")
}

errAt := errorx.Newf("happened at: %s", time.Now())
if errAt != nil {
	return errorx.Trace(err)
}

if errorx.Tracing() {
	println("error tracing is enabled")
}

See examples: example_test.go.

License

MIT License.