Exception: MultiJSON::Adapters::Oj::ParseError Private
- Inherits:
-
SyntaxError
- Object
- SyntaxError
- MultiJSON::Adapters::Oj::ParseError
- Defined in:
- lib/multi_json/adapters/oj.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
In certain cases the Oj gem may throw a “JSON::ParserError“ exception instead of its own class. Neither “::JSON::ParserError“ nor “::Oj::ParseError“ is guaranteed to be defined, so we can’t reference them directly — match by walking the exception’s ancestry by class name instead. This will not catch subclasses of those classes, which shouldn’t be a problem since neither library is known to subclass them.
Class Method Summary collapse
-
.===(exception) ⇒ Boolean
private
Case equality for exception matching in rescue clauses.
Class Method Details
.===(exception) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Case equality for exception matching in rescue clauses
39 40 41 |
# File 'lib/multi_json/adapters/oj.rb', line 39 def self.===(exception) exception.class.ancestors.any? { |ancestor| WRAPPED_CLASSES.include?(ancestor.to_s) } end |