go_api_client 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/lib/go_api_client/http_fetcher.rb +5 -5
- data/lib/go_api_client/version.rb +1 -1
- metadata +1 -1
data/Gemfile.lock
CHANGED
@@ -4,7 +4,10 @@ require 'net/https'
|
|
4
4
|
module GoApiClient
|
5
5
|
class HttpFetcher
|
6
6
|
|
7
|
-
class
|
7
|
+
class ConnectionError <StandardError
|
8
|
+
end
|
9
|
+
|
10
|
+
class HttpError < ConnectionError
|
8
11
|
attr_reader :http_code
|
9
12
|
def initialize(msg, http_code)
|
10
13
|
super(msg)
|
@@ -12,9 +15,6 @@ module GoApiClient
|
|
12
15
|
end
|
13
16
|
end
|
14
17
|
|
15
|
-
class ConnectionError <StandardError
|
16
|
-
end
|
17
|
-
|
18
18
|
NET_HTTP_EXCEPTIONS = [
|
19
19
|
EOFError,
|
20
20
|
Errno::ECONNABORTED,
|
@@ -48,12 +48,12 @@ module GoApiClient
|
|
48
48
|
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
|
49
49
|
def #{meth}!(url, options={})
|
50
50
|
response_body = #{meth}(url, options)
|
51
|
-
return response_body
|
52
51
|
if failure?
|
53
52
|
message = "Could not fetch url \#{url}."
|
54
53
|
GoApiClient.logger.error("\#{message} The response returned status \#{status} with body `\#{response_body}'")
|
55
54
|
raise HttpError.new(message, status)
|
56
55
|
end
|
56
|
+
return response_body
|
57
57
|
rescue *NET_HTTP_EXCEPTIONS => e
|
58
58
|
message = "Could not connect to url \#{url}."
|
59
59
|
GoApiClient.logger.error("\#{message}. The error was \#{e.message}")
|