summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-08-05 18:26:18 +0800
committerUnknwon <u@gogs.io>2015-08-05 18:26:18 +0800
commit74bd6b939c725e6e9c7395fe6356e9a6d7d662e6 (patch)
treeaeb3f0ac190f6c1bee4f754ca70067f77b7b9280 /models
parentcf90312b8f47a0dc028f1263cbf763bce1cb6d77 (diff)
downloadgitea-74bd6b939c725e6e9c7395fe6356e9a6d7d662e6.tar.gz
gitea-74bd6b939c725e6e9c7395fe6356e9a6d7d662e6.zip
milestone: edit
Diffstat (limited to 'models')
-rw-r--r--models/error.go21
-rw-r--r--models/issue.go5
2 files changed, 23 insertions, 3 deletions
diff --git a/models/error.go b/models/error.go
index 04f850def9..01adeb425b 100644
--- a/models/error.go
+++ b/models/error.go
@@ -134,3 +134,24 @@ func IsErrRepoNotExist(err error) bool {
func (err ErrRepoNotExist) Error() string {
return fmt.Sprintf("repository does not exist [id: %d, uid: %d, name: %s]", err.ID, err.UID, err.Name)
}
+
+// _____ .__.__ __
+// / \ |__| | ____ _______/ |_ ____ ____ ____
+// / \ / \| | | _/ __ \ / ___/\ __\/ _ \ / \_/ __ \
+// / Y \ | |_\ ___/ \___ \ | | ( <_> ) | \ ___/
+// \____|__ /__|____/\___ >____ > |__| \____/|___| /\___ >
+// \/ \/ \/ \/ \/
+
+type ErrMilestoneNotExist struct {
+ ID int64
+ Index int64
+}
+
+func IsErrMilestoneNotExist(err error) bool {
+ _, ok := err.(ErrMilestoneNotExist)
+ return ok
+}
+
+func (err ErrMilestoneNotExist) Error() string {
+ return fmt.Sprintf("milestone does not exist [id: %d, index: %d]", err.ID, err.Index)
+}
diff --git a/models/issue.go b/models/issue.go
index 0835d1c9c5..44988a32c5 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -23,7 +23,6 @@ import (
var (
ErrIssueNotExist = errors.New("Issue does not exist")
ErrLabelNotExist = errors.New("Label does not exist")
- ErrMilestoneNotExist = errors.New("Milestone does not exist")
ErrWrongIssueCounter = errors.New("Invalid number of issues for this milestone")
ErrAttachmentNotExist = errors.New("Attachment does not exist")
ErrAttachmentNotLinked = errors.New("Attachment does not belong to this issue")
@@ -691,7 +690,7 @@ func MilestoneById(id int64) (*Milestone, error) {
if err != nil {
return nil, err
} else if !has {
- return nil, ErrMilestoneNotExist
+ return nil, ErrMilestoneNotExist{id, 0}
}
return m, nil
}
@@ -703,7 +702,7 @@ func GetMilestoneByIndex(repoId, idx int64) (*Milestone, error) {
if err != nil {
return nil, err
} else if !has {
- return nil, ErrMilestoneNotExist
+ return nil, ErrMilestoneNotExist{0, idx}
}
return m, nil
}