errors: Added 409 Conflict helper function

This commit is contained in:
Tudor Roman 2018-02-11 15:51:33 +02:00
parent 94ea766c9e
commit 3b6f38a45c
No known key found for this signature in database
GPG Key ID: 5AFEDD03CA5A1EA4

View File

@ -91,3 +91,13 @@ func InternalServerError(id, format string, a ...interface{}) error {
Status: http.StatusText(500), Status: http.StatusText(500),
} }
} }
// Conflict generates a 409 error.
func Conflict(id, format string, a ...interface{}) error {
return &Error{
Id: id,
Code: 409,
Detail: fmt.Sprintf(format, a...),
Status: http.StatusText(409),
}
}