-
Notifications
You must be signed in to change notification settings - Fork 2
/
doc.go
23 lines (19 loc) · 869 Bytes
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
Package vice provides bad behaviours for Go 2/1.13+ error values.
vice defines common types of errors, as seen in existing packages, as expressed
through methods on the errors of the form:
IsXXX() bool
Errors of these types can be created and checked by vice. When used with Go 2
error value wrapping, intermediate code layers don't have to know about the
behaviours or types of errors, and may add additional information, without
altering how the error is handled in the topmost layer:
// Create an error when your database can't find a user record
err := vice.New(vice.NotFound, "user not found")
// many intermediate layers of code, passing the error on, and wrapping it
// ...
// In your central request handler middleware
if vice.Is(err, vice.NotFound) {
// respond appropriately to the client
}
*/
package vice // import "github.com/jbowes/vice"