diff options
author | Luke Kanies <luke@madstop.com> | 2007-09-06 19:24:25 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2007-09-06 19:24:25 -0500 |
commit | 4104bd3ee9fa146b49aa446fbf4cc3edcdf0974d (patch) | |
tree | dfa1a147f8949c4fd09484979714397c4248f666 /lib | |
parent | b7f42441b91c921cd31f3d8c7875ce98bdedf786 (diff) | |
download | puppet-4104bd3ee9fa146b49aa446fbf4cc3edcdf0974d.tar.gz puppet-4104bd3ee9fa146b49aa446fbf4cc3edcdf0974d.tar.xz puppet-4104bd3ee9fa146b49aa446fbf4cc3edcdf0974d.zip |
Fixing #807. The exception handling should more closely resemble how it used to be done.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/network/handler/configuration.rb | 4 | ||||
-rw-r--r-- | lib/puppet/parser/interpreter.rb | 19 |
2 files changed, 16 insertions, 7 deletions
diff --git a/lib/puppet/network/handler/configuration.rb b/lib/puppet/network/handler/configuration.rb index 05c86f22e..2c72d3d2b 100644 --- a/lib/puppet/network/handler/configuration.rb +++ b/lib/puppet/network/handler/configuration.rb @@ -111,7 +111,9 @@ class Puppet::Network::Handler if Puppet[:trace] puts detail.backtrace end - Puppet.err detail + unless local? + Puppet.err detail.to_s + end raise XMLRPC::FaultException.new( 1, detail.to_s ) diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb index 93a4bc170..a4ea26572 100644 --- a/lib/puppet/parser/interpreter.rb +++ b/lib/puppet/parser/interpreter.rb @@ -77,20 +77,27 @@ class Puppet::Parser::Interpreter if Puppet[:trace] puts detail.backtrace end - Puppet.err "Could not parse for environment %s: %s" % [environment, detail] - return nil + msg = "Could not parse" + if environment and environment != "" + msg += " for environment %s" % environment + end + msg += ": %s" % detail + raise Puppet::Error, detail end end # Return the parser for a specific environment. def parser(environment) if ! @parsers[environment] or @parsers[environment].reparse? - if tmp = create_parser(environment) + # This will throw an exception if it does not succeed. We only + # want to get rid of the old parser if we successfully create a new + # one. + begin + tmp = create_parser(environment) @parsers[environment].clear if @parsers[environment] @parsers[environment] = tmp - end - unless @parsers[environment] - raise Puppet::Error, "Could not parse any configurations" + rescue + # Nothing, yo. end end @parsers[environment] |