summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo_file.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/repo_file.go')
-rw-r--r--routers/api/v1/repo_file.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/routers/api/v1/repo_file.go b/routers/api/v1/repo_file.go
index 540cd32fa8..3b2225e669 100644
--- a/routers/api/v1/repo_file.go
+++ b/routers/api/v1/repo_file.go
@@ -6,7 +6,6 @@ package v1
import (
"github.com/gogits/gogs/models"
- "github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/git"
"github.com/gogits/gogs/modules/middleware"
"github.com/gogits/gogs/routers/repo"
@@ -23,12 +22,12 @@ func GetRepoRawFile(ctx *middleware.Context) {
if err == git.ErrNotExist {
ctx.Error(404)
} else {
- ctx.JSON(500, &base.ApiJsonErr{"GetBlobByPath: " + err.Error(), base.DOC_URL})
+ ctx.APIError(500, "GetBlobByPath", err)
}
return
}
if err = repo.ServeBlob(ctx, blob); err != nil {
- ctx.JSON(500, &base.ApiJsonErr{"ServeBlob: " + err.Error(), base.DOC_URL})
+ ctx.APIError(500, "ServeBlob", err)
}
}
@@ -36,7 +35,7 @@ func GetRepoArchive(ctx *middleware.Context) {
repoPath := models.RepoPath(ctx.Params(":username"), ctx.Params(":reponame"))
gitRepo, err := git.OpenRepository(repoPath)
if err != nil {
- ctx.Handle(500, "RepoAssignment Invalid repo: "+repoPath, err)
+ ctx.APIError(500, "OpenRepository", err)
return
}
ctx.Repo.GitRepo = gitRepo