From 9db4acc62e2d253c21ce9aed2e21003ff235d5b5 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sat, 8 Aug 2015 17:10:34 +0800 Subject: improve fork process --- models/error.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'models/error.go') diff --git a/models/error.go b/models/error.go index e52d9b16d9..0e554e5273 100644 --- a/models/error.go +++ b/models/error.go @@ -225,6 +225,20 @@ func (err ErrRepoNotExist) Error() string { return fmt.Sprintf("repository does not exist [id: %d, uid: %d, name: %s]", err.ID, err.UID, err.Name) } +type ErrRepoAlreadyExist struct { + Uname string + Name string +} + +func IsErrRepoAlreadyExist(err error) bool { + _, ok := err.(ErrRepoAlreadyExist) + return ok +} + +func (err ErrRepoAlreadyExist) Error() string { + return fmt.Sprintf("repository already exists [uname: %d, name: %s]", err.Uname, err.Name) +} + // _____ .__.__ __ // / \ |__| | ____ _______/ |_ ____ ____ ____ // / \ / \| | | _/ __ \ / ___/\ __\/ _ \ / \_/ __ \ -- cgit v1.2.3