mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-04 06:24:11 +01:00 
			
		
		
		
	Mark TemplateLoading error as "UnprocessableEntity" (#19445)
- Don't return Internal Server error if the user provide incorrect label template, instead return UnprocessableEntity. - Resolves #19399
This commit is contained in:
		
							parent
							
								
									0dcc74a8a7
								
							
						
					
					
						commit
						240b3aa218
					
				@ -22,6 +22,7 @@ import (
 | 
				
			|||||||
	"code.gitea.io/gitea/modules/convert"
 | 
						"code.gitea.io/gitea/modules/convert"
 | 
				
			||||||
	"code.gitea.io/gitea/modules/git"
 | 
						"code.gitea.io/gitea/modules/git"
 | 
				
			||||||
	"code.gitea.io/gitea/modules/log"
 | 
						"code.gitea.io/gitea/modules/log"
 | 
				
			||||||
 | 
						repo_module "code.gitea.io/gitea/modules/repository"
 | 
				
			||||||
	"code.gitea.io/gitea/modules/setting"
 | 
						"code.gitea.io/gitea/modules/setting"
 | 
				
			||||||
	api "code.gitea.io/gitea/modules/structs"
 | 
						api "code.gitea.io/gitea/modules/structs"
 | 
				
			||||||
	"code.gitea.io/gitea/modules/util"
 | 
						"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) {
 | 
							if repo_model.IsErrRepoAlreadyExist(err) {
 | 
				
			||||||
			ctx.Error(http.StatusConflict, "", "The repository with the same name already exists.")
 | 
								ctx.Error(http.StatusConflict, "", "The repository with the same name already exists.")
 | 
				
			||||||
		} else if db.IsErrNameReserved(err) ||
 | 
							} else if db.IsErrNameReserved(err) ||
 | 
				
			||||||
			db.IsErrNamePatternNotAllowed(err) {
 | 
								db.IsErrNamePatternNotAllowed(err) ||
 | 
				
			||||||
 | 
								repo_module.IsErrIssueLabelTemplateLoad(err) {
 | 
				
			||||||
			ctx.Error(http.StatusUnprocessableEntity, "", err)
 | 
								ctx.Error(http.StatusUnprocessableEntity, "", err)
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			ctx.Error(http.StatusInternalServerError, "CreateRepository", err)
 | 
								ctx.Error(http.StatusInternalServerError, "CreateRepository", err)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user