Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions invopop/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ func IsForbidden(err error) bool {
return asError(err, http.StatusForbidden) != nil
}

// IsInvalid is a helper that will return true if the response error is
// an invalid request.
func IsInvalid(err error) bool {
return asError(err, http.StatusUnprocessableEntity) != nil
}

// AsResponseError will extract the ResponseError from the provided error
// or return nil if no match found.
func AsResponseError(err error) *ResponseError {
Expand Down