aboutsummaryrefslogtreecommitdiff
path: root/models
diff options
context:
space:
mode:
Diffstat (limited to 'models')
-rw-r--r--models/action.go6
-rw-r--r--models/error.go22
-rw-r--r--models/errors/issue.go15
-rw-r--r--models/issue.go4
4 files changed, 20 insertions, 27 deletions
diff --git a/models/action.go b/models/action.go
index d04f6d3d..d830a36f 100644
--- a/models/action.go
+++ b/models/action.go
@@ -343,7 +343,7 @@ func UpdateIssuesCommit(doer *User, repo *Repository, commits []*PushCommit) err
issue, err := GetIssueByRef(ref)
if err != nil {
- if IsErrIssueNotExist(err) {
+ if errors.IsIssueNotExist(err) {
continue
}
return err
@@ -386,7 +386,7 @@ func UpdateIssuesCommit(doer *User, repo *Repository, commits []*PushCommit) err
issue, err := GetIssueByRef(ref)
if err != nil {
- if IsErrIssueNotExist(err) {
+ if errors.IsIssueNotExist(err) {
continue
}
return err
@@ -426,7 +426,7 @@ func UpdateIssuesCommit(doer *User, repo *Repository, commits []*PushCommit) err
issue, err := GetIssueByRef(ref)
if err != nil {
- if IsErrIssueNotExist(err) {
+ if errors.IsIssueNotExist(err) {
continue
}
return err
diff --git a/models/error.go b/models/error.go
index 0e327d15..72edb560 100644
--- a/models/error.go
+++ b/models/error.go
@@ -436,28 +436,6 @@ func (err ErrBranchNotExist) Error() string {
return fmt.Sprintf("branch does not exist [name: %s]", err.Name)
}
-// .___
-// | | ______ ________ __ ____
-// | |/ ___// ___/ | \_/ __ \
-// | |\___ \ \___ \| | /\ ___/
-// |___/____ >____ >____/ \___ >
-// \/ \/ \/
-
-type ErrIssueNotExist struct {
- ID int64
- RepoID int64
- Index int64
-}
-
-func IsErrIssueNotExist(err error) bool {
- _, ok := err.(ErrIssueNotExist)
- return ok
-}
-
-func (err ErrIssueNotExist) Error() string {
- return fmt.Sprintf("issue does not exist [id: %d, repo_id: %d, index: %d]", err.ID, err.RepoID, err.Index)
-}
-
// __________ .__ .__ __________ __
// \______ \__ __| | | |\______ \ ____ ________ __ ____ _______/ |_
// | ___/ | \ | | | | _// __ \/ ____/ | \_/ __ \ / ___/\ __\
diff --git a/models/errors/issue.go b/models/errors/issue.go
index 4ea898fb..903cc977 100644
--- a/models/errors/issue.go
+++ b/models/errors/issue.go
@@ -6,6 +6,21 @@ package errors
import "fmt"
+type IssueNotExist struct {
+ ID int64
+ RepoID int64
+ Index int64
+}
+
+func IsIssueNotExist(err error) bool {
+ _, ok := err.(IssueNotExist)
+ return ok
+}
+
+func (err IssueNotExist) Error() string {
+ return fmt.Sprintf("issue does not exist [id: %d, repo_id: %d, index: %d]", err.ID, err.RepoID, err.Index)
+}
+
type InvalidIssueReference struct {
Ref string
}
diff --git a/models/issue.go b/models/issue.go
index 32e20b65..6bcda7a9 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -827,7 +827,7 @@ func GetRawIssueByIndex(repoID, index int64) (*Issue, error) {
if err != nil {
return nil, err
} else if !has {
- return nil, ErrIssueNotExist{0, repoID, index}
+ return nil, errors.IssueNotExist{0, repoID, index}
}
return issue, nil
}
@@ -847,7 +847,7 @@ func getRawIssueByID(e Engine, id int64) (*Issue, error) {
if err != nil {
return nil, err
} else if !has {
- return nil, ErrIssueNotExist{id, 0, 0}
+ return nil, errors.IssueNotExist{id, 0, 0}
}
return issue, nil
}