Permalink
Browse files

add Psych::SyntaxError to the list of rescued YAML exceptions

  • Loading branch information...
1 parent 5856fc5 commit cae1d46f1c944dc58f57cb60385b125f8b2c8ded @tenderlove tenderlove committed Jan 5, 2011
Showing with 7 additions and 0 deletions.
  1. +7 −0 activesupport/lib/active_support/json/backends/yaml.rb
@@ -7,6 +7,13 @@ module Yaml
ParseError = ::StandardError
extend self
+ EXCEPTIONS = [::ArgumentError] # :nodoc:
+ begin
+ require 'psych'
+ EXCEPTIONS << Psych::SyntaxError
+ rescue LoadError
+ end
+
# Parses a JSON string or IO and converts it into an object
def decode(json)
if json.respond_to?(:read)

0 comments on commit cae1d46

Please sign in to comment.