summaryrefslogtreecommitdiffstats
path: root/models/error.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-08-03 11:51:22 -0700
committerUnknwon <u@gogs.io>2016-08-03 11:51:22 -0700
commite7fd65f0cf748201e70f7a8de089275099890f63 (patch)
tree4158ce20ccc3106ea84656678bf062bd164ad9b3 /models/error.go
parent2eeb0ec9b032ea02d315922feb762637ecd9ddc8 (diff)
downloadgitea-e7fd65f0cf748201e70f7a8de089275099890f63.tar.gz
gitea-e7fd65f0cf748201e70f7a8de089275099890f63.zip
#3290 better code structure and batch minor improvements
Diffstat (limited to 'models/error.go')
-rw-r--r--models/error.go44
1 files changed, 3 insertions, 41 deletions
diff --git a/models/error.go b/models/error.go
index a6c54ab088..1778701ef6 100644
--- a/models/error.go
+++ b/models/error.go
@@ -5,7 +5,6 @@
package models
import (
- "bytes"
"fmt"
)
@@ -35,30 +34,6 @@ func (err ErrNamePatternNotAllowed) Error() string {
return fmt.Sprintf("name pattern is not allowed [pattern: %s]", err.Pattern)
}
-type ErrMultipleErrors struct {
- Errors []error
-}
-
-func IsErrMultipleErrors(err error) bool {
- _, ok := err.(ErrMultipleErrors)
- return ok
-}
-
-func (err ErrMultipleErrors) Error() string {
- var message bytes.Buffer
-
- message.WriteString("Multiple errors encountered: ")
-
- for i := range err.Errors {
- message.WriteString(err.Errors[i].Error())
- if i < len(err.Errors)-1 {
- message.WriteString("; ")
- }
- }
-
- return message.String()
-}
-
// ____ ___
// | | \______ ___________
// | | / ___// __ \_ __ \
@@ -558,7 +533,8 @@ func (err ErrCommentNotExist) Error() string {
// \/ \/ \/ \/
type ErrLabelNotExist struct {
- ID int64
+ LabelID int64
+ RepoID int64
}
func IsErrLabelNotExist(err error) bool {
@@ -567,21 +543,7 @@ func IsErrLabelNotExist(err error) bool {
}
func (err ErrLabelNotExist) Error() string {
- return fmt.Sprintf("label does not exist [id: %d]", err.ID)
-}
-
-type ErrLabelNotValidForRepository struct {
- ID int64
- RepoID int64
-}
-
-func IsErrLabelNotValidForRepository(err error) bool {
- _, ok := err.(ErrLabelNotValidForRepository)
- return ok
-}
-
-func (err ErrLabelNotValidForRepository) Error() string {
- return fmt.Sprintf("label is not valid for repository [label_id: %d, repo_id: %d]", err.ID, err.RepoID)
+ return fmt.Sprintf("label does not exist [label_id: %d, repo_id: %d]", err.LabelID, err.RepoID)
}
// _____ .__.__ __