Exception: MultiJSON::AdapterError
- Inherits:
-
ArgumentError
- Object
- ArgumentError
- MultiJSON::AdapterError
- Defined in:
- lib/multi_json/adapter_error.rb
Overview
Raised when an adapter cannot be loaded or is not recognized
Class Method Summary collapse
-
.build(original_exception) ⇒ AdapterError
Build an AdapterError from an original exception.
Instance Method Summary collapse
-
#initialize(message = nil, cause: nil) ⇒ AdapterError
constructor
Create a new AdapterError.
Constructor Details
#initialize(message = nil, cause: nil) ⇒ AdapterError
Create a new AdapterError
16 17 18 19 |
# File 'lib/multi_json/adapter_error.rb', line 16 def initialize( = nil, cause: nil) super() set_backtrace(cause.backtrace) if cause end |
Class Method Details
.build(original_exception) ⇒ AdapterError
Build an AdapterError from an original exception
The original exception’s class name is included in the message so a downstream consumer reading just the AdapterError can tell whether the underlying failure was a ‘LoadError`, an `ArgumentError` from the spec validator, or some other class without having to look at `error.cause` separately.
34 35 36 37 38 39 40 |
# File 'lib/multi_json/adapter_error.rb', line 34 def self.build(original_exception) new( "Did not recognize your adapter specification " \ "(#{original_exception.class}: #{original_exception.}).", cause: original_exception ) end |