summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-06-11 08:51:56 -0700
committerStan Hu <stanhu@gmail.com>2018-06-11 08:51:56 -0700
commit9e193bd685f586d6360df7546ec3f44f785d8f44 (patch)
treeadc7ebb1abb6eb9019a17c0167de2a1cf2bcdce8
parentf646a8b9bc95fd6cecaa754f7dd0e8370c201502 (diff)
downloadgitlab-ce-sh-github-importer-imporve-error.tar.gz
GitHub Rake importer: Fail with a clearer explanation if GitLab username is wrongsh-github-importer-imporve-error
-rw-r--r--lib/tasks/import.rake4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake
index aafbe52e5f8..91babce9b65 100644
--- a/lib/tasks/import.rake
+++ b/lib/tasks/import.rake
@@ -9,8 +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)
@github_repo = extras.empty? ? nil : extras.first
+
+ raise "GitLab user #{gitlab_username} not found. Please specify a valid username." unless @current_user
end
def run!