Package recover
contains basic functions
which helps to work with recover
in bit pleasant way.
go get -u github.com/thepkg/recover
import "github.com/thepkg/recover"
func f1() {
defer recover.All(func(err interface{}) {
fmt.Printf("got error: %s", err.(error))
})
}
func f2() {
defer recover.Any([]error{ErrorUsernameBlank, ErrorUsernameAlreadyTaken}, func(err interface{}) {
fmt.Printf("got error: %s", err.(error))
})
}