https://github.com/cristalhq/errorx
Better `errors` package for Go
https://github.com/cristalhq/errorx
error-handling error-messages errors go golang stacktraces
Last synced: about 2 months ago
JSON representation
Better `errors` package for Go
- Host: GitHub
- URL: https://github.com/cristalhq/errorx
- Owner: cristalhq
- License: mit
- Created: 2023-06-01T09:53:53.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-07-19T10:58:58.000Z (9 months ago)
- Last Synced: 2025-08-09T21:40:05.867Z (9 months ago)
- Topics: error-handling, error-messages, errors, go, golang, stacktraces
- Language: Go
- Homepage:
- Size: 26.4 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# errorx
[![build-img]][build-url]
[![pkg-img]][pkg-url]
[![version-img]][version-url]
TODO
## Rationale
TODO
## Features
* Simple and easy.
* Safe & fast.
* Tested.
* Dependency-free.
See [these docs][pkg-url] or [GUIDE.md](GUIDE.md) for more details.
## Install
Go version 1.18+
```
go get github.com/cristalhq/errorx
```
## Example
```go
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](example_test.go).
## License
[MIT License](LICENSE).
[build-img]: https://github.com/cristalhq/errorx/workflows/build/badge.svg
[build-url]: https://github.com/cristalhq/errorx/actions
[pkg-img]: https://pkg.go.dev/badge/cristalhq/errorx
[pkg-url]: https://pkg.go.dev/github.com/cristalhq/errorx
[version-img]: https://img.shields.io/github/v/release/cristalhq/errorx
[version-url]: https://github.com/cristalhq/errorx/releases