pretty_timeouts 1.1 → 1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c0f3c4e90786e50ee934e37c899f0163ba53e056
4
- data.tar.gz: a8a440143d014a7c7de84d9e9c98e1ccdc6c78f3
3
+ metadata.gz: 13f3dbd2e2c184519f1177eed02cc04deb97ca57
4
+ data.tar.gz: 5b39bfc5385089f223e6744a326a625abd2ff09d
5
5
  SHA512:
6
- metadata.gz: 8fd5f9c892e0cd82e906c7235b0d3111fa4e9970136f48aa895eefa2e2c853d0d3e2f59872f844db77eccdd8cce6b1a3361ca08308090370f7214c6b46952065
7
- data.tar.gz: 44e6e3431ef5232334a5216d209690b116fceffa0ffbad66890e45b2058975b717df12cbb096bfe5891414b32c306261ce9345a44e82c3d32d5ddd4d9585eb32
6
+ metadata.gz: 419f0880525477e843ac486ecba52a6c18f70190fe34f77fac9bb9ea51d012fd30cd494a972be4e646f2d7c73ddf745edcbaf5a264cdfd399031c3ed1d4f8230
7
+ data.tar.gz: 64d374a6c13cdb4027ab28da00d64907c08d91aa91f44bd82d568f7a2d946866bea5fdaea15b4c03665a543f804df4739e9728b4c93ebe0e2ee13a000a755f39
data/CHANGELOG.md CHANGED
@@ -5,5 +5,8 @@ CHANGELOG inspiration from http://keepachangelog.com/.
5
5
 
6
6
  ## Unreleased
7
7
 
8
+ ## [1.1] - March 17, 2016
9
+ * Catch ConnectionFailed errors too
10
+
8
11
  ## [1.1] - March 17, 2016
9
12
  * Build error with info so that rescueing classes have more to work with.
@@ -4,5 +4,6 @@ require "faraday"
4
4
  module PrettyTimeouts
5
5
  end
6
6
 
7
+ require "pretty_timeouts/connection_failed"
7
8
  require "pretty_timeouts/timeout_error"
8
9
  require "pretty_timeouts/middleware"
@@ -0,0 +1,16 @@
1
+ module PrettyTimeouts
2
+ class ConnectionFailed < ::Faraday::Error::ConnectionFailed
3
+ attr_reader :service_name, :open_timeout, :url, :original_message
4
+
5
+ def initialize(service_name, open_timeout, url, original_message)
6
+ @service_name = service_name
7
+ @open_timeout = open_timeout
8
+ @url = url
9
+ @original_message = original_message
10
+ end
11
+
12
+ def message
13
+ "#{service_name} open timeout of #{open_timeout}s reached attempting to connect to #{url}. Got error: '#{original_message}'"
14
+ end
15
+ end
16
+ end
@@ -8,10 +8,11 @@ module PrettyTimeouts
8
8
  def call(env)
9
9
  begin
10
10
  @app.call(env)
11
- rescue Faraday::Error::TimeoutError => e
12
- error = ::PrettyTimeouts::TimeoutError.new(@service_name, env[:request][:timeout], env[:url])
13
- error.set_backtrace e.backtrace
14
- raise error
11
+ rescue Faraday::Error::TimeoutError
12
+ raise ::PrettyTimeouts::TimeoutError.new(@service_name, env[:request][:timeout], env[:url])
13
+
14
+ rescue Faraday::Error::ConnectionFailed => e
15
+ raise ::PrettyTimeouts::ConnectionFailed.new(@service_name, env[:request][:open_timeout], env[:url], e.message)
15
16
  end
16
17
  end
17
18
  end
@@ -1,3 +1,3 @@
1
1
  module PrettyTimeouts
2
- VERSION = "1.1"
2
+ VERSION = "1.2"
3
3
  end
@@ -23,4 +23,5 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "bundler", "~> 1.11"
24
24
  spec.add_development_dependency "rake", "~> 10.0"
25
25
  spec.add_development_dependency "rspec", "~> 3.0"
26
+ spec.add_development_dependency "net-http-persistent"
26
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pretty_timeouts
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: '1.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Donald Plummer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-17 00:00:00.000000000 Z
11
+ date: 2016-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: net-http-persistent
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description:
70
84
  email:
71
85
  - donald.plummer@gmail.com
@@ -84,6 +98,7 @@ files:
84
98
  - bin/console
85
99
  - bin/setup
86
100
  - lib/pretty_timeouts.rb
101
+ - lib/pretty_timeouts/connection_failed.rb
87
102
  - lib/pretty_timeouts/middleware.rb
88
103
  - lib/pretty_timeouts/timeout_error.rb
89
104
  - lib/pretty_timeouts/version.rb