diff options
author | Saku Ytti <saku@ytti.fi> | 2014-02-20 15:31:26 +0200 |
---|---|---|
committer | Saku Ytti <saku@ytti.fi> | 2014-02-20 15:31:26 +0200 |
commit | 06e5f68db6cfcbd80295874db1f00a25e8ba1229 (patch) | |
tree | 0f728121e40a69b0f8403c8094baed97f05185f3 /lib | |
parent | 227ea783d3598c2bd974cdaf4aac8c255870e264 (diff) |
Figure out which parent class we rescued
Rakefile changes
Bump up gemspec version
Diffstat (limited to 'lib')
-rw-r--r-- | lib/oxidized/node.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb index 5f09096..05a926c 100644 --- a/lib/oxidized/node.rb +++ b/lib/oxidized/node.rb @@ -44,9 +44,14 @@ module Oxidized if input.connect self input.get end - rescue *rescue_fail.keys.flatten => err - level = rescue_fail[err.class] - Log.send(level, '%s raised %s with msg "%s"' % [self.ip, err.class, err.message]) + rescue *rescue_fail.keys => err + resc = '' + if not level = rescue_fail[err.class] + resc = err.class.ancestors.find{|e|rescue_fail.keys.include? e} + level = rescue_fail[resc] + resc = " (rescued #{resc})" + end + Log.send(level, '%s raised %s%s with msg "%s"' % [self.ip, err.class, resc, err.message]) return false end end |