Skip to content

Commit ac67f2d

Browse files
committed
(maint) provide a workaround for Psych::SyntaxError
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. This was uncovered by the recent move to catch StandardError rather than the catchall that was there before.
1 parent af29410 commit ac67f2d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/puppet/parser/functions/parseyaml.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ module Puppet::Parser::Functions
1616

1717
begin
1818
YAML::load(arguments[0]) || arguments[1]
19-
rescue StandardError => e
19+
# in ruby 1.9.3 Psych::SyntaxError is a RuntimeException
20+
# this still needs to catch that and work also on rubies that
21+
# do not have Psych available.
22+
rescue StandardError, Module.const_get('Psych::SyntaxError') => e
2023
if arguments[1]
2124
arguments[1]
2225
else

0 commit comments

Comments
 (0)