From 06e5f68db6cfcbd80295874db1f00a25e8ba1229 Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Thu, 20 Feb 2014 15:31:26 +0200 Subject: Figure out which parent class we rescued Rakefile changes Bump up gemspec version --- lib/oxidized/node.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib') 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 -- cgit v1.2.1