class MultiJson::Adapters::Oj::ParseError
In certain cases OJ gem may throw JSON::ParserError exception instead of its own class. Also, we can’t expect ::JSON::ParserError and ::Oj::ParseError to always be defined, since it’s often not the case. Because of this, we can’t reference those classes directly and have to do string comparison instead. This will not catch subclasses, but it shouldn’t be a problem since the library is not known to be using it (at least for now).
Constants
- WRAPPED_CLASSES
Public Class Methods
# File lib/multi_json/adapters/oj.rb, line 22 def self.===(exception) case exception when ::SyntaxError true else WRAPPED_CLASSES.include?(exception.class.to_s) end end