Issue: Show error prompt when add repository to team and it does not exist #533

This commit is contained in:
Unknwon 2014-10-10 05:06:12 -04:00
parent c31606daf9
commit 85c9f7c5f3
3 changed files with 7 additions and 0 deletions

View file

@ -124,6 +124,11 @@ func TeamsRepoAction(ctx *middleware.Context) {
var repo *models.Repository
repo, err = models.GetRepositoryByName(ctx.Org.Organization.Id, repoName)
if err != nil {
if err == models.ErrRepoNotExist {
ctx.Flash.Error(ctx.Tr("org.teams.add_nonexistent_repo"))
ctx.Redirect(ctx.Org.OrgLink + "/teams/" + ctx.Org.Team.LowerName + "/repositories")
return
}
ctx.Handle(500, "GetRepositoryByName", err)
return
}