浏览代码

better error message

Unknwon 9 年之前
父节点
当前提交
6a66e5fc98
共有 3 个文件被更改,包括 6 次插入2 次删除
  1. 1 0
      conf/locale/locale_en-US.ini
  2. 0 0
      modules/bindata/bindata.go
  3. 5 2
      routers/repo/repo.go

+ 1 - 0
conf/locale/locale_en-US.ini

@@ -367,6 +367,7 @@ migrate.clone_address = Clone Address
 migrate.clone_address_desc = This can be a HTTP/HTTPS/GIT URL or local server path.
 migrate.permission_denied = You are not allowed to import local repositories.
 migrate.invalid_local_path = Invalid local path, it does not exist or not a directory.
+migrate.failed = Migration failed: %v
 
 forked_from = forked from
 fork_from_self = You cannot fork repository you already owned!

文件差异内容过多而无法显示
+ 0 - 0
modules/bindata/bindata.go


+ 5 - 2
routers/repo/repo.go

@@ -203,12 +203,15 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
 		}
 	}
 
-	if strings.Contains(err.Error(), "fatal:") ||
+	if strings.Contains(err.Error(), "Authentication failed") ||
 		strings.Contains(err.Error(), "could not read Username") {
-		ctx.Data["Err_CloneAddr"] = true
 		ctx.Data["Err_Auth"] = true
 		ctx.RenderWithErr(ctx.Tr("form.auth_failed", strings.Replace(err.Error(), ":"+form.AuthPassword+"@", ":<password>@", 1)), MIGRATE, &form)
 		return
+	} else if strings.Contains(err.Error(), "fatal:") {
+		ctx.Data["Err_CloneAddr"] = true
+		ctx.RenderWithErr(ctx.Tr("repo.migrate.failed", strings.Replace(err.Error(), ":"+form.AuthPassword+"@", ":<password>@", 1)), MIGRATE, &form)
+		return
 	}
 
 	handleCreateError(ctx, err, "MigratePost", MIGRATE, &form)

部分文件因为文件数量过多而无法显示