Exception: SimpleJsonapi::SerializerInferenceError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/simple_jsonapi/helpers/exceptions.rb

Overview

The error raised when a SerializerInferrer cannot find the serializer for a resource or error.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, msg = nil) ⇒ SerializerInferenceError

Returns a new instance of SerializerInferenceError.

Parameters:

  • object (Object)

    the resource or error

  • msg (String) (defaults to: nil)


30
31
32
33
# File 'lib/simple_jsonapi/helpers/exceptions.rb', line 30

def initialize(object, msg = nil)
  @object = object
  @msg = msg
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



26
27
28
# File 'lib/simple_jsonapi/helpers/exceptions.rb', line 26

def object
  @object
end

Instance Method Details

#to_sObject



35
36
37
# File 'lib/simple_jsonapi/helpers/exceptions.rb', line 35

def to_s
  @msg.present? ? @msg : "Unable to infer serializer for #{object.class}"
end