aboutsummaryrefslogtreecommitdiffstats
path: root/models/error.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-07-23 15:59:19 +0800
committerUnknwon <u@gogs.io>2016-07-23 15:59:19 +0800
commitc912494609470f10401594391c6f2763684cb624 (patch)
tree1f8c047fbb9ed1ae0f852d8899cb037dfd80a47e /models/error.go
parent69dae1ec1c5265e815c8b0fedff3399438e2e380 (diff)
downloadgitea-c912494609470f10401594391c6f2763684cb624.tar.gz
gitea-c912494609470f10401594391c6f2763684cb624.zip
#3076 detect invalid tag name git error
Diffstat (limited to 'models/error.go')
-rw-r--r--models/error.go19
1 files changed, 16 insertions, 3 deletions
diff --git a/models/error.go b/models/error.go
index 69b2962475..a6cf31218c 100644
--- a/models/error.go
+++ b/models/error.go
@@ -387,7 +387,7 @@ func IsErrReleaseAlreadyExist(err error) bool {
}
func (err ErrReleaseAlreadyExist) Error() string {
- return fmt.Sprintf("Release tag already exist [tag_name: %s]", err.TagName)
+ return fmt.Sprintf("release tag already exist [tag_name: %s]", err.TagName)
}
type ErrReleaseNotExist struct {
@@ -401,7 +401,20 @@ func IsErrReleaseNotExist(err error) bool {
}
func (err ErrReleaseNotExist) Error() string {
- return fmt.Sprintf("Release tag does not exist [id: %d, tag_name: %s]", err.ID, err.TagName)
+ return fmt.Sprintf("release tag does not exist [id: %d, tag_name: %s]", err.ID, err.TagName)
+}
+
+type ErrInvalidTagName struct {
+ TagName string
+}
+
+func IsErrInvalidTagName(err error) bool {
+ _, ok := err.(ErrInvalidTagName)
+ return ok
+}
+
+func (err ErrInvalidTagName) Error() string {
+ return fmt.Sprintf("release tag name is not valid [tag_name: %s]", err.TagName)
}
// __________ .__
@@ -421,7 +434,7 @@ func IsErrBranchNotExist(err error) bool {
}
func (err ErrBranchNotExist) Error() string {
- return fmt.Sprintf("Branch does not exist [name: %s]", err.Name)
+ return fmt.Sprintf("branch does not exist [name: %s]", err.Name)
}
// __ __ ___. .__ __