emoji code passing muster

This commit is contained in:
tsmethurst
2022-01-15 17:36:15 +01:00
parent c4a533db72
commit 6bf39d0fc1
9 changed files with 104 additions and 39 deletions

View File

@ -122,3 +122,16 @@ func NewErrorInternalError(original error, helpText ...string) WithCode {
code: http.StatusInternalServerError,
}
}
// NewErrorConflict returns an ErrorWithCode 409 with the given original error and optional help text.
func NewErrorConflict(original error, helpText ...string) WithCode {
safe := "conflict"
if helpText != nil {
safe = safe + ": " + strings.Join(helpText, ": ")
}
return withCode{
original: original,
safe: errors.New(safe),
code: http.StatusConflict,
}
}