There are lots of cases, and load is probably used more than loadall.

On May 21, 2010, at 5:12 PM, Jesse A Wolfe wrote:

I started to change "load", too, but then I waffled - it was unclear if it there were any cases where I wouldn't just be wrapping it in a rescue
I'll give another stab at it.

On Fri, May 21, 2010 at 5:02 PM, Luke Kanies <[email protected]> wrote: This is only half of the battle - you need to change the 'load' method, also.


On May 21, 2010, at 3:33 PM, Jesse Wolfe wrote:

Change Autoloader's loadall to re-raise exceptions that happen when
trying to load files, rather than just warning.

Signed-off-by: Jesse Wolfe <[email protected]>
---
lib/puppet/util/autoload.rb |    2 +-
spec/unit/util/autoload.rb  |    4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/puppet/util/autoload.rb b/lib/puppet/util/autoload.rb
index 7358618..c7bf8ea 100644
--- a/lib/puppet/util/autoload.rb
+++ b/lib/puppet/util/autoload.rb
@@ -123,7 +123,7 @@ class Puppet::Util::Autoload
                   raise
               rescue Exception => detail
                   puts detail.backtrace if Puppet[:trace]
-                    warn "Could not autoload #{file}: #{detail}"
+ raise Puppet::Error, "Could not autoload #{file}: #{detail}"
               end
           end
       end
diff --git a/spec/unit/util/autoload.rb b/spec/unit/util/autoload.rb
index 220cb5f..f254f4f 100755
--- a/spec/unit/util/autoload.rb
+++ b/spec/unit/util/autoload.rb
@@ -117,10 +117,10 @@ describe Puppet::Util::Autoload do
       end

       [RuntimeError, LoadError, SyntaxError].each do |error|
- it "should not die an if a #{error.to_s} exception is thrown" do + it "should die an if a #{error.to_s} exception is thrown" do
               Kernel.expects(:require).raises error

-                lambda { @autoload.loadall }.should_not raise_error
+ lambda { @autoload.loadall }.should raise_error(Puppet::Error)
           end
       end

--
1.7.0.4

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected] . For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en .



--
Puritanism: The haunting fear that someone, somewhere, may be happy.
   -- H. L. Mencken
---------------------------------------------------------------------
Luke Kanies  -|-   http://puppetlabs.com   -|-   +1(615)594-8199


--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected] . For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en .



--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected] . For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en .


--
The world tolerates conceit from those who are successful, but not
from anybody else. -- John Blake
---------------------------------------------------------------------
Luke Kanies  -|-   http://puppetlabs.com   -|-   +1(615)594-8199

--
You received this message because you are subscribed to the Google Groups "Puppet 
Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to