Files

20 lines
566 B
Go
Raw Permalink Normal View History

// Copyright 2023 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package repo
import (
2023-09-29 16:42:39 +09:00
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/services/context"
)
2023-09-29 16:42:39 +09:00
func HandleGitError(ctx *context.Context, msg string, err error) {
if git.IsErrNotExist(err) {
ctx.Data["NotFoundPrompt"] = ctx.Locale.Tr("repo.tree_path_not_found", ctx.Repo.TreePath, ctx.Repo.RefTypeNameSubURL())
ctx.Data["NotFoundGoBackURL"] = ctx.Repo.RepoLink + "/src/" + ctx.Repo.RefTypeNameSubURL()
2025-02-17 14:13:17 +08:00
ctx.NotFound(err)
2023-09-29 16:42:39 +09:00
} else {
ctx.ServerError(msg, err)
}
}