Allows erk
error kinds to embed HTTP Statuses.
$ github.com/JosiahWitt/erkhttp
Embed HTTP Statuses in erk errors:
type ErkItemNotFound {
erk.DefaultKind
erkhttp.StatusNotFound
}
Fetch the HTTP Status using erkhttp.GetHTTPStatus
:
var ErrItemNotFound = erk.New(ErkItemNotFound{}, "item with key '{{.key}}' was not found")
func main() {
fmt.Println(erkhttp.GetHTTPStatus(ErrItemNotFound)) // Prints 404, true
}