summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Schmitt <david.schmitt@puppetlabs.com>2016-04-07 11:47:42 +0100
committerDavid Schmitt <david.schmitt@puppetlabs.com>2016-04-07 12:31:06 +0100
commit5639828bffd1beb0e44e59554e17c1a891924145 (patch)
tree0ded46e239e54520d889d51555ebb238c6dbfbfc /lib
parent3860512d5611d9c3a93f75d9594c2df43ee64acb (diff)
(maint) also catch Psych::SyntaxError
Psych::SyntaxError is a RuntimeException. This still needs to catch that. This was uncovered by the recent move to catch StandardError rather than the catchall Exception that was here before.
Diffstat (limited to 'lib')
-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 9e84055..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 StandardError => 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