https://github.com/x-mod/errors
extension of errors
https://github.com/x-mod/errors
Last synced: 5 months ago
JSON representation
extension of errors
- Host: GitHub
- URL: https://github.com/x-mod/errors
- Owner: x-mod
- License: mit
- Created: 2019-04-04T08:37:22.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-02-09T02:23:27.000Z (over 6 years ago)
- Last Synced: 2024-11-17T12:25:56.080Z (over 1 year ago)
- Language: Go
- Size: 21.5 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
errors
===
[](https://travis-ci.org/x-mod/errors) [](https://goreportcard.com/report/github.com/x-mod/errors) [](https://coveralls.io/github/x-mod/errors?branch=master) [](https://godoc.org/github.com/x-mod/errors)
extension of errors for the following features:
- annotation error
- error with code, support grpc error code
## Quick Start
````go
import "github.com/x-mod/errors"
//annotation error
e1 := errors.Annotate(err, "annotations")
e11 := errors.Annotatef(err, "annotations %s", "format")
//code error
e2 := errors.WithCode(err, errors.ErrNo(100))
//get error's code value
v2 := errors.ValueFrom(e2)
````