class MultiJson::Adapters::Oj::ParseError
(at least for now).
shouldn’t be a problem since the library is not known to be using it
do string comparison instead. This will not catch subclasses, but it
Because of this, we can’t reference those classes directly and have to
::Oj::ParseError to always be defined, since it’s often not the case.
of its own class. Also, we can’t expect ::JSON::ParserError and
In certain cases OJ gem may throw JSON::ParserError exception instead
def self.===(exception)
- Example: Match parse errors in rescue -
Returns:
-
(Boolean)- true if exception is a parse error
Parameters:
-
exception(Exception) -- exception to check
Other tags:
- Api: - private
def self.===(exception) exception.is_a?(::SyntaxError) || WRAPPED_CLASSES.include?(exception.class.to_s) end