@@ -436,7 +436,7 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
436
436
Status : models .RepositoryBeingMigrated ,
437
437
})
438
438
if err != nil {
439
- ctx . Error ( 500 , "CreateRepository" , err )
439
+ handleMigrateError ( ctx , remoteAddr , err )
440
440
return
441
441
}
442
442
@@ -472,6 +472,10 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
472
472
return
473
473
}
474
474
475
+ handleMigrateError (ctx , remoteAddr , err )
476
+ }
477
+
478
+ func handleMigrateError (ctx * context.APIContext , remoteAddr string , err error ) {
475
479
switch {
476
480
case models .IsErrRepoAlreadyExist (err ):
477
481
ctx .Error (409 , "" , "The repository with the same name already exists." )
@@ -480,7 +484,7 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
480
484
case migrations .IsTwoFactorAuthError (err ):
481
485
ctx .Error (422 , "" , "Remote visit required two factors authentication." )
482
486
case models .IsErrReachLimitOfRepo (err ):
483
- ctx .Error (422 , "" , fmt .Sprintf ("You have already reached your limit of %d repositories." , ctxUser .MaxCreationLimit ()))
487
+ ctx .Error (422 , "" , fmt .Sprintf ("You have already reached your limit of %d repositories." , ctx . User .MaxCreationLimit ()))
484
488
case models .IsErrNameReserved (err ):
485
489
ctx .Error (422 , "" , fmt .Sprintf ("The username '%s' is reserved." , err .(models.ErrNameReserved ).Name ))
486
490
case models .IsErrNamePatternNotAllowed (err ):
0 commit comments