diff options
author | Stan Hu <stanhu@gmail.com> | 2018-07-13 09:17:05 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-07-13 09:17:05 +0300 |
commit | ec4109d413f6161b43ad4cc1a6251af30d3bcf03 (patch) | |
tree | c2db2b3ae4335752d014d43516526fca48187cf0 /lib/gitlab | |
parent | 15220291ae1752b9e36ad0b2320180614ec37c59 (diff) |
Make Connection#post consistent with Connection#get and add specs
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/bitbucket_server_import/importer.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/gitlab/bitbucket_server_import/importer.rb b/lib/gitlab/bitbucket_server_import/importer.rb index e948a038e8e..580dc0bb852 100644 --- a/lib/gitlab/bitbucket_server_import/importer.rb +++ b/lib/gitlab/bitbucket_server_import/importer.rb @@ -90,12 +90,11 @@ module Gitlab shas.each do |branch_name, sha| next if sha_exists?(sha) - response = client.create_branch(project_key, repository_slug, branch_name, sha) - - if response.success? + begin + client.create_branch(project_key, repository_slug, branch_name, sha) branches_created << branch_name - else - Rails.logger.warn("BitbucketServerImporter: Unable to recreate branch for SHA #{sha}: #{response.code}") + rescue BitbucketServer::Connection::ConnectionError => e + Rails.logger.warn("BitbucketServerImporter: Unable to recreate branch for SHA #{sha}: #{e}") end end end |