diff options
Diffstat (limited to 'routers/repo/view.go')
-rw-r--r-- | routers/repo/view.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/routers/repo/view.go b/routers/repo/view.go index 512af27fc4..685dd411d6 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -44,14 +44,14 @@ func renderDirectory(ctx *context.Context, treeLink string) { entries, err := tree.ListEntries() if err != nil { - ctx.Handle(500, "ListEntries", err) + ctx.ServerError("ListEntries", err) return } entries.CustomSort(base.NaturalSortLess) ctx.Data["Files"], err = entries.GetCommitsInfo(ctx.Repo.Commit, ctx.Repo.TreePath) if err != nil { - ctx.Handle(500, "GetCommitsInfo", err) + ctx.ServerError("GetCommitsInfo", err) return } @@ -78,7 +78,7 @@ func renderDirectory(ctx *context.Context, treeLink string) { dataRc, err := readmeFile.DataAsync() if err != nil { - ctx.Handle(500, "Data", err) + ctx.ServerError("Data", err) return } defer dataRc.Close() @@ -117,7 +117,7 @@ func renderDirectory(ctx *context.Context, treeLink string) { if len(ctx.Repo.TreePath) > 0 { latestCommit, err = ctx.Repo.Commit.GetCommitByPath(ctx.Repo.TreePath) if err != nil { - ctx.Handle(500, "GetCommitByPath", err) + ctx.ServerError("GetCommitByPath", err) return } } @@ -145,7 +145,7 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st blob := entry.Blob() dataRc, err := blob.DataAsync() if err != nil { - ctx.Handle(500, "DataAsync", err) + ctx.ServerError("DataAsync", err) return } defer dataRc.Close() @@ -288,7 +288,7 @@ func Home(ctx *context.Context) { } } - ctx.Handle(404, "Home", fmt.Errorf(ctx.Tr("units.error.no_unit_allowed_repo"))) + ctx.NotFound("Home", fmt.Errorf(ctx.Tr("units.error.no_unit_allowed_repo"))) } func renderCode(ctx *context.Context) { @@ -362,7 +362,7 @@ func RenderUserCards(ctx *context.Context, total int, getter func(page int) ([]* items, err := getter(pager.Current()) if err != nil { - ctx.Handle(500, "getter", err) + ctx.ServerError("getter", err) return } ctx.Data["Cards"] = items @@ -392,13 +392,13 @@ func Forks(ctx *context.Context) { forks, err := ctx.Repo.Repository.GetForks() if err != nil { - ctx.Handle(500, "GetForks", err) + ctx.ServerError("GetForks", err) return } for _, fork := range forks { if err = fork.GetOwner(); err != nil { - ctx.Handle(500, "GetOwner", err) + ctx.ServerError("GetOwner", err) return } } |