summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util/methodhelper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/util/methodhelper.rb')
-rw-r--r--lib/puppet/util/methodhelper.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/puppet/util/methodhelper.rb b/lib/puppet/util/methodhelper.rb
index 32fca1877..ecc9d537f 100644
--- a/lib/puppet/util/methodhelper.rb
+++ b/lib/puppet/util/methodhelper.rb
@@ -12,11 +12,10 @@ module Puppet::Util::MethodHelper
def set_options(options)
options.each do |param,value|
method = param.to_s + "="
- begin
+ if respond_to? method
self.send(method, value)
- rescue NoMethodError
- raise ArgumentError, "Invalid parameter %s to object class %s" %
- [param,self.class.to_s]
+ else
+ raise ArgumentError, "Invalid parameter #{param} to object class #{self.class}"
end
end
end