From 697508d65588526a230c5d51daca34ad9f9a1f2b Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Wed, 30 Jun 2010 14:53:26 -0700 Subject: [#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. --- lib/puppet/application.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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) -- cgit