diff options
Diffstat (limited to 'models/repo/repo.go')
-rw-r--r-- | models/repo/repo.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/models/repo/repo.go b/models/repo/repo.go index 4fd97dcd1b..ce698baaef 100644 --- a/models/repo/repo.go +++ b/models/repo/repo.go @@ -43,6 +43,10 @@ func (err ErrUserDoesNotHaveAccessToRepo) Error() string { return fmt.Sprintf("user doesn't have access to repo [user_id: %d, repo_name: %s]", err.UserID, err.RepoName) } +func (err ErrUserDoesNotHaveAccessToRepo) Unwrap() error { + return util.ErrPermissionDenied +} + var ( reservedRepoNames = []string{".", "..", "-"} reservedRepoPatterns = []string{"*.git", "*.wiki", "*.rss", "*.atom"} @@ -643,6 +647,11 @@ func (err ErrRepoNotExist) Error() string { err.ID, err.UID, err.OwnerName, err.Name) } +// Unwrap unwraps this error as a ErrNotExist error +func (err ErrRepoNotExist) Unwrap() error { + return util.ErrNotExist +} + // GetRepositoryByOwnerAndNameCtx returns the repository by given owner name and repo name func GetRepositoryByOwnerAndNameCtx(ctx context.Context, ownerName, repoName string) (*Repository, error) { var repo Repository |