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 +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/pretty_timeouts.rb +1 -0
- data/lib/pretty_timeouts/connection_failed.rb +16 -0
- data/lib/pretty_timeouts/middleware.rb +5 -4
- data/lib/pretty_timeouts/version.rb +1 -1
- data/pretty_timeouts.gemspec +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13f3dbd2e2c184519f1177eed02cc04deb97ca57
|
4
|
+
data.tar.gz: 5b39bfc5385089f223e6744a326a625abd2ff09d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 419f0880525477e843ac486ecba52a6c18f70190fe34f77fac9bb9ea51d012fd30cd494a972be4e646f2d7c73ddf745edcbaf5a264cdfd399031c3ed1d4f8230
|
7
|
+
data.tar.gz: 64d374a6c13cdb4027ab28da00d64907c08d91aa91f44bd82d568f7a2d946866bea5fdaea15b4c03665a543f804df4739e9728b4c93ebe0e2ee13a000a755f39
|
data/CHANGELOG.md
CHANGED
data/lib/pretty_timeouts.rb
CHANGED
@@ -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
|
12
|
-
|
13
|
-
|
14
|
-
|
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
|
data/pretty_timeouts.gemspec
CHANGED
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.
|
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-
|
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
|