summaryrefslogtreecommitdiffstats
path: root/modules/git/error.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/git/error.go')
-rw-r--r--modules/git/error.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/git/error.go b/modules/git/error.go
index 1aae5a37a2..6e4f26de13 100644
--- a/modules/git/error.go
+++ b/modules/git/error.go
@@ -64,3 +64,18 @@ func IsErrUnsupportedVersion(err error) bool {
func (err ErrUnsupportedVersion) Error() string {
return fmt.Sprintf("Operation requires higher version [required: %s]", err.Required)
}
+
+// ErrBranchNotExist represents a "BranchNotExist" kind of error.
+type ErrBranchNotExist struct {
+ Name string
+}
+
+// IsErrBranchNotExist checks if an error is a ErrBranchNotExist.
+func IsErrBranchNotExist(err error) bool {
+ _, ok := err.(ErrBranchNotExist)
+ return ok
+}
+
+func (err ErrBranchNotExist) Error() string {
+ return fmt.Sprintf("branch does not exist [name: %s]", err.Name)
+}