sevenwire-rest-client 0.9.5 → 0.9.6

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/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 9
4
- :patch: 5
4
+ :patch: 6
@@ -31,4 +31,9 @@ module RestClient
31
31
  class RequestTimeout < Exception
32
32
  ErrorMessage = 'Request timed out'
33
33
  end
34
+
35
+ # The server refused the connection
36
+ class ConnectionRefused < Exception
37
+ ErrorMessage = 'Server refused connection'
38
+ end
34
39
  end
@@ -124,6 +124,8 @@ module RestClient
124
124
  raise RestClient::ServerBrokeConnection
125
125
  rescue Timeout::Error
126
126
  raise RestClient::RequestTimeout
127
+ rescue Errno::ECONNREFUSED
128
+ raise RestClient::ConnectionRefused
127
129
  end
128
130
 
129
131
  def setup_credentials(req)
data/spec/request_spec.rb CHANGED
@@ -194,6 +194,11 @@ describe RestClient::Request do
194
194
  lambda { @request.transmit(@uri, 'req', nil) }.should raise_error(RestClient::ServerBrokeConnection)
195
195
  end
196
196
 
197
+ it "catches Errno::ECONNREFUSED and shows the more informative ConnectionRefused" do
198
+ @http.stub!(:request).and_raise(Errno::ECONNREFUSED)
199
+ lambda { @request.transmit(@uri, 'req', nil) }.should raise_error(RestClient::ConnectionRefused)
200
+ end
201
+
197
202
  it "class method execute wraps constructor" do
198
203
  req = mock("rest request")
199
204
  RestClient::Request.should_receive(:new).with(1 => 2).and_return(req)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sevenwire-rest-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Wiggins