diff --git a/lib/learn_open/lessons/base_lesson.rb b/lib/learn_open/lessons/base_lesson.rb index 2b4d4f0..5064d4a 100644 --- a/lib/learn_open/lessons/base_lesson.rb +++ b/lib/learn_open/lessons/base_lesson.rb @@ -22,6 +22,9 @@ def initialize(lesson_data, options = {}) @repo_path = lesson.clone_repo @organization, @name = repo_path.split('/') + if @organization.empty? and not @name.empty? + raise "The repo path had an empty organization. Most likely, you need to link your Github account to your Learn account through the Learn website." + end @git_server = lesson.git_server @dot_learn = lesson.dot_learn diff --git a/lib/learn_open/services/lesson_downloader.rb b/lib/learn_open/services/lesson_downloader.rb index e460b42..9cf8caf 100644 --- a/lib/learn_open/services/lesson_downloader.rb +++ b/lib/learn_open/services/lesson_downloader.rb @@ -43,9 +43,11 @@ def fork_repo(retries = 3) Timeout::timeout(15) do client.fork_repo(repo_name: lesson.name) end - rescue Timeout::Error + rescue Timeout::Error => e if retries > 0 io.puts "There was a problem forking this lesson. Retrying..." + io.puts "Git had the following error:" + io.puts e fork_repo(retries - 1) else io.puts "There is an issue connecting to Learn. Please try again." @@ -63,9 +65,11 @@ def clone_repo(retries = 3) Timeout::timeout(15) do git_adapter.clone("git@#{lesson.git_server}:#{lesson.repo_path}.git", lesson.name, path: location) end - rescue Git::GitExecuteError + rescue Git::GitExecuteError => e if retries > 0 io.puts "There was a problem cloning this lesson. Retrying..." if retries > 1 + io.puts "Git had the following error:" + io.puts e sleep(1) clone_repo(retries - 1) else @@ -75,7 +79,7 @@ def clone_repo(retries = 3) end rescue Timeout::Error if retries > 0 - io.puts "There was a problem cloning this lesson. Retrying..." + io.puts "There was a problem cloning this lesson (timed out). Retrying..." clone_repo(retries - 1) else io.puts "Cannot clone this lesson right now. Please try again."