summaryrefslogtreecommitdiff
path: root/lib/puppet/parser/functions/parseyaml.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser/functions/parseyaml.rb')
-rw-r--r--lib/puppet/parser/functions/parseyaml.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/puppet/parser/functions/parseyaml.rb b/lib/puppet/parser/functions/parseyaml.rb
index 66d0413..ba9d98a 100644
--- a/lib/puppet/parser/functions/parseyaml.rb
+++ b/lib/puppet/parser/functions/parseyaml.rb
@@ -16,7 +16,10 @@ be returned if the parsing of YAML string have failed.
begin
YAML::load(arguments[0]) || arguments[1]
- rescue Exception => e
+ # in ruby 1.9.3 Psych::SyntaxError is a RuntimeException
+ # this still needs to catch that and work also on rubies that
+ # do not have Psych available.
+ rescue StandardError, Psych::SyntaxError => e
if arguments[1]
arguments[1]
else