From 3b6f38a45c9921d7483d2cdf3192ec9706d06fbc Mon Sep 17 00:00:00 2001 From: Tudor Roman Date: Sun, 11 Feb 2018 15:51:33 +0200 Subject: [PATCH] errors: Added 409 Conflict helper function --- errors/errors.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/errors/errors.go b/errors/errors.go index f43cd2de..9aa0ecdc 100644 --- a/errors/errors.go +++ b/errors/errors.go @@ -91,3 +91,13 @@ func InternalServerError(id, format string, a ...interface{}) error { 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), + } +}