better error message

This commit is contained in:
Unknwon 2015-11-19 13:45:07 -05:00
parent c0b0ce7b1a
commit 6a66e5fc98
3 changed files with 8 additions and 4 deletions

View file

@ -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.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.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.invalid_local_path = Invalid local path, it does not exist or not a directory.
migrate.failed = Migration failed: %v
forked_from = forked from forked_from = forked from
fork_from_self = You cannot fork repository you already owned! fork_from_self = You cannot fork repository you already owned!

File diff suppressed because one or more lines are too long

View file

@ -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") { strings.Contains(err.Error(), "could not read Username") {
ctx.Data["Err_CloneAddr"] = true
ctx.Data["Err_Auth"] = true ctx.Data["Err_Auth"] = true
ctx.RenderWithErr(ctx.Tr("form.auth_failed", strings.Replace(err.Error(), ":"+form.AuthPassword+"@", ":<password>@", 1)), MIGRATE, &form) ctx.RenderWithErr(ctx.Tr("form.auth_failed", strings.Replace(err.Error(), ":"+form.AuthPassword+"@", ":<password>@", 1)), MIGRATE, &form)
return 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) handleCreateError(ctx, err, "MigratePost", MIGRATE, &form)