net_http_timeout_errors 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Tired of having to rescue an ever-growing list of Net::HTTP timeout error types?
4
4
 
5
- Just include this gem and then do:
5
+ Just load this gem and then do:
6
6
 
7
7
  ``` ruby
8
8
  begin
@@ -28,6 +28,8 @@ rescue AnotherError, *NetHttpTimeoutErrors.all
28
28
  end
29
29
  ```
30
30
 
31
+ You can still get at the original error through `NetHttpTimeoutError#original_error`.
32
+
31
33
  Did we miss an error? Please add it!
32
34
 
33
35
 
@@ -12,10 +12,16 @@ end
12
12
  class NetHttpTimeoutErrors
13
13
  def self.all
14
14
  [
15
+ EOFError,
15
16
  Errno::ECONNREFUSED,
16
17
  Errno::ECONNRESET,
17
18
  Errno::EHOSTUNREACH,
19
+ Errno::EINVAL,
18
20
  Errno::EPIPE,
21
+ Errno::ETIMEDOUT,
22
+ Net::HTTPBadResponse,
23
+ Net::HTTPHeaderSyntaxError,
24
+ Net::ProtocolError,
19
25
  SocketError,
20
26
  Timeout::Error,
21
27
  ]
@@ -1,3 +1,3 @@
1
1
  class NetHttpTimeoutErrors
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -3,15 +3,7 @@ require "net_http_timeout_errors"
3
3
 
4
4
  describe NetHttpTimeoutErrors, ".all" do
5
5
  it "has some" do
6
- NetHttpTimeoutErrors.all.wont_be_empty
7
- end
8
-
9
- # No assertions; more like runnable documentation.
10
- it "works splatted" do
11
- begin
12
- raise an_error
13
- rescue ZeroDivisionError, *NetHttpTimeoutErrors.all
14
- end
6
+ assert_includes NetHttpTimeoutErrors.all, some_timeout_error
15
7
  end
16
8
  end
17
9
 
@@ -19,7 +11,7 @@ describe NetHttpTimeoutErrors, ".conflate" do
19
11
  it "turns any handled error into a NetHttpTimeoutError" do
20
12
  assert_raises(NetHttpTimeoutError) do
21
13
  NetHttpTimeoutErrors.conflate do
22
- raise an_error
14
+ raise some_timeout_error
23
15
  end
24
16
  end
25
17
  end
@@ -35,14 +27,14 @@ describe NetHttpTimeoutErrors, ".conflate" do
35
27
  it "keeps the original error" do
36
28
  begin
37
29
  NetHttpTimeoutErrors.conflate do
38
- raise an_error
30
+ raise some_timeout_error
39
31
  end
40
32
  rescue => e
41
- assert_instance_of Timeout::Error, e.original_error
33
+ assert_instance_of some_timeout_error, e.original_error
42
34
  end
43
35
  end
44
36
  end
45
37
 
46
- def an_error
47
- Timeout::Error
38
+ def some_timeout_error
39
+ SocketError
48
40
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net_http_timeout_errors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: