backport part of #9550 (#9564)

* add ErrReactionAlreadyExist
 * extend FindReactionsOptions
 * createReaction check if exit before create
This commit is contained in:
6543 2019-12-31 18:00:17 +01:00 committed by Lauris BH
parent b4b8c9679f
commit c63a80138a
3 changed files with 51 additions and 12 deletions

View file

@ -1104,6 +1104,21 @@ func (err ErrNewIssueInsert) Error() string {
return err.OriginalError.Error()
}
// ErrReactionAlreadyExist is used when a existing reaction was try to created
type ErrReactionAlreadyExist struct {
Reaction string
}
// IsErrReactionAlreadyExist checks if an error is a ErrReactionAlreadyExist.
func IsErrReactionAlreadyExist(err error) bool {
_, ok := err.(ErrReactionAlreadyExist)
return ok
}
func (err ErrReactionAlreadyExist) Error() string {
return fmt.Sprintf("reaction '%s' already exists", err.Reaction)
}
// __________ .__ .__ __________ __
// \______ \__ __| | | |\______ \ ____ ________ __ ____ _______/ |_
// | ___/ | \ | | | | _// __ \/ ____/ | \_/ __ \ / ___/\ __\