summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@gitlab.com>2018-06-11 18:29:03 +0000
committerJames Lopez <james@gitlab.com>2018-06-11 18:29:03 +0000
commitfa1a75ae28b421c5d3bd926c2795a053e4c6af15 (patch)
tree07738bd5c5115dca4f3aaac415a11ca69090eff7
parent1dbb20d95eb6843fe903cbc875440226c1cee20d (diff)
parent28871d73ace30f5f21455cd77e38cc743968fd30 (diff)
downloadgitlab-ce-fa1a75ae28b421c5d3bd926c2795a053e4c6af15.tar.gz
Merge branch 'sh-github-importer-improve-error' into 'master'
GitHub Rake importer: Fail with a clearer explanation if GitLab username is wrong See merge request gitlab-org/gitlab-ce!19653
-rw-r--r--lib/tasks/import.rake5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake
index 0fd184d243f..fc59b3f937d 100644
--- a/lib/tasks/import.rake
+++ b/lib/tasks/import.rake
@@ -9,7 +9,10 @@ class GithubImport
def initialize(token, gitlab_username, project_path, extras)
@options = { token: token }
@project_path = project_path
- @current_user = User.find_by_username(gitlab_username)
+ @current_user = User.find_by(username: gitlab_username)
+
+ raise "GitLab user #{gitlab_username} not found. Please specify a valid username." unless @current_user
+
@github_repo = extras.empty? ? nil : extras.first
end