rescue-me 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -5
- data/lib/rescue-me.rb +16 -1
- data/lib/rescue_me/version.rb +1 -1
- data/rescue-me.gemspec +3 -3
- data/spec/lib/rescue-me_spec.rb +51 -2
- metadata +47 -16
data/Gemfile
CHANGED
@@ -5,17 +5,13 @@ gemspec
|
|
5
5
|
|
6
6
|
group :development do
|
7
7
|
if RUBY_PLATFORM =~ /darwin/i
|
8
|
-
gem '
|
9
|
-
gem 'ruby_gntp'
|
8
|
+
gem 'growl'
|
10
9
|
else
|
11
|
-
gem 'rb-fsevent', :require => false
|
12
10
|
gem 'growl', :require => false
|
13
11
|
end
|
14
12
|
if RUBY_PLATFORM =~ /linux/i
|
15
|
-
gem 'rb-inotify'
|
16
13
|
gem 'libnotify'
|
17
14
|
else
|
18
|
-
gem 'rb-inotify', :require => false
|
19
15
|
gem 'libnotify', :require => false
|
20
16
|
end
|
21
17
|
end
|
data/lib/rescue-me.rb
CHANGED
@@ -16,6 +16,9 @@ module RescueMe
|
|
16
16
|
err = [Timeout::Error,
|
17
17
|
Errno::EINVAL,
|
18
18
|
Errno::ECONNRESET,
|
19
|
+
Errno::EPIPE,
|
20
|
+
Errno::ECONNABORTED,
|
21
|
+
Errno::EBADF,
|
19
22
|
EOFError,
|
20
23
|
SocketError,
|
21
24
|
Net::HTTPBadResponse,
|
@@ -23,6 +26,18 @@ module RescueMe
|
|
23
26
|
Net::ProtocolError]
|
24
27
|
|
25
28
|
err << Net::HTTP::Persistent::Error if defined? Net::HTTP::Persistent::Error
|
29
|
+
err << OpenSSL::SSL::SSLError if defined? OpenSSL::SSL::SSLError
|
30
|
+
|
31
|
+
err
|
32
|
+
end
|
33
|
+
|
34
|
+
def active_resource_errors(opts = {})
|
35
|
+
err = net_http_errors(opts)
|
36
|
+
|
37
|
+
if defined? ActiveResource::ConnectionError
|
38
|
+
err.delete(Timeout::Error)
|
39
|
+
err << ActiveResource::ConnectionError
|
40
|
+
end
|
26
41
|
|
27
42
|
err
|
28
43
|
end
|
@@ -55,7 +70,7 @@ module RescueMe
|
|
55
70
|
net_smtp_server_errors + net_smtp_client_errors
|
56
71
|
end
|
57
72
|
|
58
|
-
%w[net_http net_smtp_server net_smtp_client net_smtp].each do |type|
|
73
|
+
%w[net_http active_resource net_smtp_server net_smtp_client net_smtp].each do |type|
|
59
74
|
define_method(type + '_errors_with') do |arg, *opts|
|
60
75
|
opts = opts.first || Hash.new
|
61
76
|
errors_with((type + '_errors').to_sym, arg, opts)
|
data/lib/rescue_me/version.rb
CHANGED
data/rescue-me.gemspec
CHANGED
@@ -15,9 +15,9 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = RescueMe::VERSION
|
17
17
|
|
18
|
-
gem.add_development_dependency 'rspec', '~> 2.
|
18
|
+
gem.add_development_dependency 'rspec', '~> 2.10'
|
19
19
|
gem.add_development_dependency 'rake', '~> 0.9.2'
|
20
|
-
gem.add_development_dependency "guard", "~>
|
21
|
-
gem.add_development_dependency "guard-rspec", "~>
|
20
|
+
gem.add_development_dependency "guard", "~> 1.1"
|
21
|
+
gem.add_development_dependency "guard-rspec", "~> 1.0"
|
22
22
|
gem.add_development_dependency "guard-bundler", "~> 0.1.3"
|
23
23
|
end
|
data/spec/lib/rescue-me_spec.rb
CHANGED
@@ -12,6 +12,7 @@ describe RescueMe do
|
|
12
12
|
describe '.net_http_errors' do
|
13
13
|
before :each do
|
14
14
|
Net::HTTP.send(:remove_const, :Persistent) if defined? Net::HTTP::Persistent
|
15
|
+
OpenSSL::SSL.send(:remove_const, :SSLError) if defined? OpenSSL::SSL::SSLError
|
15
16
|
end
|
16
17
|
|
17
18
|
it 'should return a list of errors' do
|
@@ -20,7 +21,7 @@ describe RescueMe do
|
|
20
21
|
|
21
22
|
it 'should include Net::HTTP:Persistent::Error if that library is defined' do
|
22
23
|
class Net::HTTP::Persistent
|
23
|
-
class Error
|
24
|
+
class Error; end
|
24
25
|
end
|
25
26
|
|
26
27
|
subject.net_http_errors.include?(Net::HTTP::Persistent::Error).should be_true
|
@@ -31,11 +32,59 @@ describe RescueMe do
|
|
31
32
|
|
32
33
|
# Define this after the method so we can ask the array if it's included.
|
33
34
|
class Net::HTTP::Persistent
|
34
|
-
class Error
|
35
|
+
class Error; end
|
35
36
|
end
|
36
37
|
|
37
38
|
errors.include?(Net::HTTP::Persistent::Error).should be_false
|
38
39
|
end
|
40
|
+
|
41
|
+
it 'should include OpenSSL::SSL::SSLError if that library is defined' do
|
42
|
+
module OpenSSL::SSL
|
43
|
+
class SSLError
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
subject.net_http_errors.include?(OpenSSL::SSL::SSLError).should be_true
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should not include OpenSSL::SSL::SSLError if that library is not defined' do
|
51
|
+
errors = subject.net_http_errors
|
52
|
+
|
53
|
+
class OpenSSL::SSL::SSLError < StandardError
|
54
|
+
end
|
55
|
+
|
56
|
+
errors.include?(OpenSSL::SSL::SSLError).should be_false
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '.active_resource_errors' do
|
61
|
+
before :each do
|
62
|
+
ActiveResource.send(:remove_const, :ConnectionError) if defined? ActiveResource::ConnectionError
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'should return a list of errors' do
|
66
|
+
should_return_a_list_of_errors(:active_resource_errors)
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should include ActiveResource::ConnectionError if it is defined' do
|
70
|
+
class ActiveResource
|
71
|
+
class ConnectionError
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
subject.active_resource_errors.include?(ActiveResource::ConnectionError).should be_true
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'should not include ActiveResource::ConnectionError if it is not defined' do
|
79
|
+
errors = subject.active_resource_errors
|
80
|
+
|
81
|
+
class ActiveResource
|
82
|
+
class ConnectionError
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
errors.include?(ActiveResource::ConnectionError).should be_false
|
87
|
+
end
|
39
88
|
end
|
40
89
|
|
41
90
|
describe '.net_smtp_server_errors' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rescue-me
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,27 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 2.
|
21
|
+
version: '2.10'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.10'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rake
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
@@ -32,32 +37,47 @@ dependencies:
|
|
32
37
|
version: 0.9.2
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.9.2
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: guard
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ~>
|
42
52
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
53
|
+
version: '1.1'
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.1'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: guard-rspec
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ~>
|
53
68
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
69
|
+
version: '1.0'
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '1.0'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: guard-bundler
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ~>
|
@@ -65,7 +85,12 @@ dependencies:
|
|
65
85
|
version: 0.1.3
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.1.3
|
69
94
|
description: Instead of hardcoding lists of exceptions to rescue, put them in one
|
70
95
|
place!
|
71
96
|
email:
|
@@ -98,15 +123,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
123
|
- - ! '>='
|
99
124
|
- !ruby/object:Gem::Version
|
100
125
|
version: '0'
|
126
|
+
segments:
|
127
|
+
- 0
|
128
|
+
hash: -1373983880853834472
|
101
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
130
|
none: false
|
103
131
|
requirements:
|
104
132
|
- - ! '>='
|
105
133
|
- !ruby/object:Gem::Version
|
106
134
|
version: '0'
|
135
|
+
segments:
|
136
|
+
- 0
|
137
|
+
hash: -1373983880853834472
|
107
138
|
requirements: []
|
108
139
|
rubyforge_project:
|
109
|
-
rubygems_version: 1.8.
|
140
|
+
rubygems_version: 1.8.24
|
110
141
|
signing_key:
|
111
142
|
specification_version: 3
|
112
143
|
summary: Provides common exception rescue lists
|