diff options
author | Saku Ytti <saku@ytti.fi> | 2014-02-28 23:05:20 +0200 |
---|---|---|
committer | Saku Ytti <saku@ytti.fi> | 2014-02-28 23:05:20 +0200 |
commit | 65df741de7bdd837dc64f40b1fd3083cc98c9ad3 (patch) | |
tree | 133e0cfa13d5f9fbe303ebe99373bf62001d829d /lib/oxidized/nodes.rb | |
parent | 554ed10e16544c76447cc4e97865055eeef47482 (diff) |
Rescue all StandardError from modules
If module crashes with unexpected error class, rescue it, and write it
backtrace
Also log if unknown model is attempted instead of crash
Diffstat (limited to 'lib/oxidized/nodes.rb')
-rw-r--r-- | lib/oxidized/nodes.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/oxidized/nodes.rb b/lib/oxidized/nodes.rb index a6aa2f9..4cdbfbb 100644 --- a/lib/oxidized/nodes.rb +++ b/lib/oxidized/nodes.rb @@ -11,7 +11,13 @@ module Oxidized @source = CFG.source[:default] Oxidized.mgr.source = @source Oxidized.mgr.source[@source].new.load.each do |node| - new.push Node.new node + n = nil + begin + n = Node.new node + rescue LoadError => err + Log.warn 'load error %s with node %s' % [err.message, node] + end + new.push n if n end replace new end |