(#16856) Fix failing test for Ruby 2.0.0 (different YAML exception)

YAML in 2.0.0 is a different implementation and throws a different type
of SyntaxError than in earlier Rubies. This fix uses the same mechanism
as the Yaml Ruby indirector for handling exceptions from YAML
loading/parsing.