Class: Cuprum::Rails::Serializers::Json::ErrorSerializer
- Inherits:
-
BaseSerializer
- Object
- BaseSerializer
- Cuprum::Rails::Serializers::Json::ErrorSerializer
- Defined in:
- lib/cuprum/rails/serializers/json/error_serializer.rb
Overview
Converts a Cuprum::Error to JSON using the #as_json method.
Instance Method Summary collapse
-
#call(error, **_) ⇒ Hash
Converts the Cuprum error to JSON.
Methods inherited from BaseSerializer
Instance Method Details
#call(error, **_) ⇒ Hash
Converts the Cuprum error to JSON.
Calls and returns the #as_json method of the error.
16 17 18 19 20 21 22 |
# File 'lib/cuprum/rails/serializers/json/error_serializer.rb', line 16 def call(error, **_) unless error.is_a?(Cuprum::Error) raise ArgumentError, 'object must be a Cuprum::Error' end error.as_json end |