diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2022-03-31 17:20:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-31 17:20:39 +0800 |
commit | d4f84f1c937e24e71aa5f05c58d440cde741450f (patch) | |
tree | 18571ad08fabe6d1090ea4d2674beab3b1c00a6e /models/error.go | |
parent | 43332a483f7838df66e0209eb9c15d4aba3d5874 (diff) | |
download | gitea-d4f84f1c937e24e71aa5f05c58d440cde741450f.tar.gz gitea-d4f84f1c937e24e71aa5f05c58d440cde741450f.zip |
Move reaction to models/issues/ (#19264)
* Move reaction to models/issues/
* Fix test
* move the function
* improve code
* Update models/issues/reaction.go
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'models/error.go')
-rw-r--r-- | models/error.go | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/models/error.go b/models/error.go index cbfb60790f..fbd2f97185 100644 --- a/models/error.go +++ b/models/error.go @@ -765,36 +765,6 @@ func (err ErrPullWasClosed) Error() string { return fmt.Sprintf("Pull request [%d] %d was already closed", err.ID, err.Index) } -// ErrForbiddenIssueReaction is used when a forbidden reaction was try to created -type ErrForbiddenIssueReaction struct { - Reaction string -} - -// IsErrForbiddenIssueReaction checks if an error is a ErrForbiddenIssueReaction. -func IsErrForbiddenIssueReaction(err error) bool { - _, ok := err.(ErrForbiddenIssueReaction) - return ok -} - -func (err ErrForbiddenIssueReaction) Error() string { - return fmt.Sprintf("'%s' is not an allowed reaction", err.Reaction) -} - -// 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) -} - // __________ .__ .__ __________ __ // \______ \__ __| | | |\______ \ ____ ________ __ ____ _______/ |_ // | ___/ | \ | | | | _// __ \/ ____/ | \_/ __ \ / ___/\ __\ |