OctoFetcher: Moved repositories fail explicitly

This commit is contained in:
Olle Jonsson 2016-11-10 20:37:46 +01:00
parent 88b23ba790
commit d4dfc99127

View File

@ -244,6 +244,8 @@ Make sure, that you push tags to remote repo via 'git push --tags'"
end
end
MovedPermanentlyError = Class.new(RuntimeError)
# Iterates through all pages until there are no more :next pages to follow
# yields the result per page
#
@ -261,6 +263,9 @@ Make sure, that you push tags to remote repo via 'git push --tags'"
check_github_response { client.send(method, user_project, *args) }
last_response = client.last_response
if last_response.status == 301
raise MovedPermanentlyError, last_response.data[:url]
end
yield(last_response.data)
@ -291,7 +296,9 @@ Make sure, that you push tags to remote repo via 'git push --tags'"
Retriable.retriable(retry_options) do
yield
end
rescue MovedPermanentlyError => e
Helper.log.error("#{e.class}: #{e.message}")
sys_abort("The repository has moved, please update your configuration")
rescue Octokit::Forbidden => e
Helper.log.error("#{e.class}: #{e.message}")
sys_abort("Exceeded retry limit")