1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Improve org error handling (#2117)

* Improve ErrOrgNotExist type
Return new error type
Use good error check
Use new method to check error
Update tests

* Fix unchanged method name report
This commit is contained in:
Antoine GIRARD
2017-07-06 15:30:19 +02:00
committed by Lunny Xiao
parent 2ef33b5338
commit 30787e48f2
7 changed files with 26 additions and 12 deletions

View File

@@ -59,7 +59,7 @@ func CreateFork(ctx *context.APIContext, form api.CreateForkOption) {
} else {
org, err := models.GetOrgByName(*form.Organization)
if err != nil {
if err == models.ErrOrgNotExist {
if models.IsErrOrgNotExist(err) {
ctx.Error(422, "", err)
} else {
ctx.Error(500, "GetOrgByName", err)