No description
| try | ||
| .drone.yml | ||
| .editorconfig | ||
| .golangci.yaml | ||
| .pre-commit-config.yaml | ||
| go.mod | ||
| LICENSE | ||
| README.md | ||
gotry
This package is a fork of lainio's err2 package.
Handle errors
Instead of the idiomatic go way of handling errors, which involves if-conditions for every possible error, ...
func myFunction() (err error) {
b, err := ioutil.ReadAll(r)
if err != nil {
return err
}
}
you can wrap the error-throwing function in a try wrapper.
func myFunction() (err error) {
defer err2.Return(&err)
b := try.Bytes(ioutil.ReadAll(r))
return
}