summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2010-06-30 14:53:26 -0700
committerMarkus Roberts <Markus@reality.com>2010-07-01 13:48:09 -0700
commit697508d65588526a230c5d51daca34ad9f9a1f2b (patch)
tree3c75c32940f7f8345af383dfbf3083a4eadaf39d
parent2639a561951c40aac2c916b8b8d593d6cc827935 (diff)
downloadpuppet-697508d65588526a230c5d51daca34ad9f9a1f2b.tar.gz
puppet-697508d65588526a230c5d51daca34ad9f9a1f2b.tar.xz
puppet-697508d65588526a230c5d51daca34ad9f9a1f2b.zip
[#4108] Missing constants fail deliberately and with a message
Previously, any failed call to Puppet::Application.find would result in an error being raised by const_get, resulting in a messy crash with a stack trace. Now that error is handled, and the application will print a message and exit.
-rw-r--r--lib/puppet/application.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/puppet/application.rb b/lib/puppet/application.rb
index 8aa3708aa..ac2cc1002 100644
--- a/lib/puppet/application.rb
+++ b/lib/puppet/application.rb
@@ -214,7 +214,12 @@ class Application
end
def find(name)
- self.const_get(name.to_s.capitalize)
+ begin
+ self.const_get(name.to_s.capitalize)
+ rescue
+ puts "Const '#{name.to_s.capitalize}' appears to be undefined. Unable to continue without it."
+ Kernel::exit(1)
+ end
end
def [](name)