Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gocs/errored
error set in const; declare constant errors in go lang
https://github.com/gocs/errored
error error-handling go golang
Last synced: about 1 month ago
JSON representation
error set in const; declare constant errors in go lang
- Host: GitHub
- URL: https://github.com/gocs/errored
- Owner: gocs
- License: mit
- Created: 2021-09-18T08:39:39.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-10-10T02:42:48.000Z (about 2 years ago)
- Last Synced: 2023-07-27T22:08:57.869Z (over 1 year ago)
- Topics: error, error-handling, go, golang
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# errored
[![Go Reference](https://pkg.go.dev/badge/github.com/gocs/errored.svg)](https://pkg.go.dev/github.com/gocs/errored)
![lint go code](https://github.com/gocs/errored/actions/workflows/lint.yml/badge.svg)declare constant errors
## philosophy
When an error is created, it is usually never get edited, is just string, and is expected not to change throughout the runtime.
## installation
```
go get github.com/gocs/errored
```## how to use
```go
package mainimport (
"fmt""github.com/gocs/errored"
)// ErrBad occurs when the error is random
const ErrBad = errored.New("bad error")func doSomething() error {
return ErrBad
}func main() {
if err := doSomething(); err != nil {
fmt.Println("error:", err)
}
}```
## contributing
Before sending a PR, please discuss your change by raising an issue.
## license
MIT (c) 2021 gocs