aboutsummaryrefslogtreecommitdiff
path: root/routers
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-04-06 01:37:01 -0400
committerUnknwon <u@gogs.io>2017-04-06 01:37:01 -0400
commitec491b023f96abca4794c9518f1663c9c94b0eb3 (patch)
tree3c96eea8427a70537f5fce2a8192308908dd3528 /routers
parentf191bff0b9ac11dc7571d1f87c4940afa94a0ce3 (diff)
api/repo: fix nil error panic
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/repo/repo.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go
index 3f0e8025..e095954a 100644
--- a/routers/api/v1/repo/repo.go
+++ b/routers/api/v1/repo/repo.go
@@ -167,7 +167,7 @@ func CreateUserRepo(ctx *context.APIContext, owner *models.User, opt api.CreateR
} else {
if repo != nil {
if err = models.DeleteRepository(ctx.User.ID, repo.ID); err != nil {
- log.Error(4, "DeleteRepository: %v", err)
+ log.Error(2, "DeleteRepository: %v", err)
}
}
ctx.Error(500, "CreateRepository", err)
@@ -221,7 +221,7 @@ func Migrate(ctx *context.APIContext, f form.MigrateRepo) {
}
return
} else if !org.IsOrganization() {
- ctx.Error(403, "", err)
+ ctx.Error(403, "", "Given user is not an organization")
return
}
ctxUser = org
@@ -235,7 +235,7 @@ func Migrate(ctx *context.APIContext, f form.MigrateRepo) {
if ctxUser.IsOrganization() && !ctx.User.IsAdmin {
// Check ownership of organization.
if !ctxUser.IsOwnedBy(ctx.User.ID) {
- ctx.Error(403, "", "Given user is not owner of organization.")
+ ctx.Error(403, "", "Given user is not owner of organization")
return
}
}
@@ -248,7 +248,7 @@ func Migrate(ctx *context.APIContext, f form.MigrateRepo) {
case addrErr.IsURLError:
ctx.Error(422, "", err)
case addrErr.IsPermissionDenied:
- ctx.Error(422, "", "You are not allowed to import local repositories.")
+ ctx.Error(422, "", "You are not allowed to import local repositories")
case addrErr.IsInvalidPath:
ctx.Error(422, "", "Invalid local path, it does not exist or not a directory.")
default:
@@ -270,7 +270,7 @@ func Migrate(ctx *context.APIContext, f form.MigrateRepo) {
if err != nil {
if repo != nil {
if errDelete := models.DeleteRepository(ctxUser.ID, repo.ID); errDelete != nil {
- log.Error(4, "DeleteRepository: %v", errDelete)
+ log.Error(2, "DeleteRepository: %v", errDelete)
}
}
ctx.Error(500, "MigrateRepository", models.HandleMirrorCredentials(err.Error(), true))