diff options
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 |