diff options
author | Luke Kanies <luke@madstop.com> | 2009-02-11 14:33:48 -0600 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-02-12 07:39:11 +1100 |
commit | 319822af6d58c3e0c391e86cfd836ec31de43c67 (patch) | |
tree | 44c79a0ce0b767145837fa66d8e0888eaafff553 /lib/puppet/util/autoload.rb | |
parent | 6b0c1b9170c69829bdf5956d1dec0949dcc08b35 (diff) | |
download | puppet-319822af6d58c3e0c391e86cfd836ec31de43c67.tar.gz puppet-319822af6d58c3e0c391e86cfd836ec31de43c67.tar.xz puppet-319822af6d58c3e0c391e86cfd836ec31de43c67.zip |
Fixing #1869 - autoloaded files should never leak exceptions
Ruby's exception hierarchy is a bit strange, in that only
exceptions that sub RuntimeError are caught by default.
This patch explicitly catches the base class, Exception,
which means that LoadError, SyntaxError, and any
RuntimeErrors will all be caught.
This is done for both load() and loadall(); load() uses
Kernel.load, but loadall() uses Kernel.require.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet/util/autoload.rb')
-rw-r--r-- | lib/puppet/util/autoload.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/puppet/util/autoload.rb b/lib/puppet/util/autoload.rb index 535d9ef2e..0c80f8b06 100644 --- a/lib/puppet/util/autoload.rb +++ b/lib/puppet/util/autoload.rb @@ -78,7 +78,7 @@ class Puppet::Util::Autoload name = symbolize(name) loaded name, file return true - rescue LoadError => detail + rescue Exception => detail # I have no idea what's going on here, but different versions # of ruby are raising different errors on missing files. unless detail.to_s =~ /^no such file/i @@ -115,7 +115,7 @@ class Puppet::Util::Autoload begin Kernel.require file loaded(name, file) - rescue => detail + rescue Exception => detail if Puppet[:trace] puts detail.backtrace end |