lib/resque/helpers.rb in resque-mongo-1.4.0 vs lib/resque/helpers.rb in resque-mongo-1.8.1

- old
+ new

@@ -27,12 +27,18 @@ # Given a string, returns a Ruby object. def decode(object) return unless object if defined? Yajl - Yajl::Parser.parse(object, :check_utf8 => false) + begin + Yajl::Parser.parse(object, :check_utf8 => false) + rescue Yajl::ParseError + end else - JSON.parse(object) + begin + JSON.parse(object) + rescue JSON::ParserError + end end end # Given a word with dashes, returns a camel cased version of it. #