diff options
author | Gusted <williamzijl7@hotmail.com> | 2022-04-22 17:19:55 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-22 19:19:55 +0200 |
commit | 240b3aa218ceeea579e622435800a49fa1820910 (patch) | |
tree | d36cc384c7cc20d98068410e005ede395942bad7 /routers | |
parent | 0dcc74a8a7eebe816f855ad0375714c52f8b785a (diff) | |
download | gitea-240b3aa218ceeea579e622435800a49fa1820910.tar.gz gitea-240b3aa218ceeea579e622435800a49fa1820910.zip |
Mark TemplateLoading error as "UnprocessableEntity" (#19445)
- Don't return Internal Server error if the user provide incorrect label
template, instead return UnprocessableEntity.
- Resolves #19399
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/v1/repo/repo.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index 7df5864455..16942dd3ba 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -22,6 +22,7 @@ import ( "code.gitea.io/gitea/modules/convert" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" + repo_module "code.gitea.io/gitea/modules/repository" "code.gitea.io/gitea/modules/setting" api "code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/modules/util" @@ -248,7 +249,8 @@ func CreateUserRepo(ctx *context.APIContext, owner *user_model.User, opt api.Cre if repo_model.IsErrRepoAlreadyExist(err) { ctx.Error(http.StatusConflict, "", "The repository with the same name already exists.") } else if db.IsErrNameReserved(err) || - db.IsErrNamePatternNotAllowed(err) { + db.IsErrNamePatternNotAllowed(err) || + repo_module.IsErrIssueLabelTemplateLoad(err) { ctx.Error(http.StatusUnprocessableEntity, "", err) } else { ctx.Error(http.StatusInternalServerError, "CreateRepository", err) |