Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/bitbucket_server/client.rb14
-rw-r--r--lib/bitbucket_server/connection.rb17
2 files changed, 17 insertions, 14 deletions
diff --git a/lib/bitbucket_server/client.rb b/lib/bitbucket_server/client.rb
index 83e8808db07..6a608058813 100644
--- a/lib/bitbucket_server/client.rb
+++ b/lib/bitbucket_server/client.rb
@@ -4,18 +4,6 @@ module BitbucketServer
class Client
attr_reader :connection
- ServerError = Class.new(StandardError)
-
- SERVER_ERRORS = [SocketError,
- OpenSSL::SSL::SSLError,
- Errno::ECONNRESET,
- Errno::ECONNREFUSED,
- Errno::EHOSTUNREACH,
- Net::OpenTimeout,
- Net::ReadTimeout,
- Gitlab::HTTP::BlockedUrlError,
- BitbucketServer::Connection::ConnectionError].freeze
-
def initialize(options = {})
@connection = Connection.new(options)
end
@@ -64,8 +52,6 @@ module BitbucketServer
def get_collection(path, type, page_offset: 0, limit: nil)
paginator = BitbucketServer::Paginator.new(connection, Addressable::URI.escape(path), type, page_offset: page_offset, limit: limit)
BitbucketServer::Collection.new(paginator)
- rescue *SERVER_ERRORS => e
- raise ServerError, e
end
end
end
diff --git a/lib/bitbucket_server/connection.rb b/lib/bitbucket_server/connection.rb
index 7efcdcf8619..9c14b26c65a 100644
--- a/lib/bitbucket_server/connection.rb
+++ b/lib/bitbucket_server/connection.rb
@@ -7,6 +7,17 @@ module BitbucketServer
DEFAULT_API_VERSION = '1.0'
SEPARATOR = '/'
+ NETWORK_ERRORS = [
+ SocketError,
+ OpenSSL::SSL::SSLError,
+ Errno::ECONNRESET,
+ Errno::ECONNREFUSED,
+ Errno::EHOSTUNREACH,
+ Net::OpenTimeout,
+ Net::ReadTimeout,
+ Gitlab::HTTP::BlockedUrlError
+ ].freeze
+
attr_reader :api_version, :base_uri, :username, :token
ConnectionError = Class.new(StandardError)
@@ -27,6 +38,8 @@ module BitbucketServer
check_errors!(response)
response.parsed_response
+ rescue *NETWORK_ERRORS => e
+ raise ConnectionError, e
end
def post(path, body)
@@ -38,6 +51,8 @@ module BitbucketServer
check_errors!(response)
response.parsed_response
+ rescue *NETWORK_ERRORS => e
+ raise ConnectionError, e
end
# We need to support two different APIs for deletion:
@@ -55,6 +70,8 @@ module BitbucketServer
check_errors!(response)
response.parsed_response
+ rescue *NETWORK_ERRORS => e
+ raise ConnectionError, e
end
private