Class: SimpleJsonapi::Errors::WrappedError

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_jsonapi/errors/wrapped_error.rb

Overview

A generic serializable error class.

Direct Known Subclasses

BadRequest

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cause = nil, **attributes) ⇒ WrappedError

Returns a new instance of WrappedError.

Parameters:

  • cause (Object) (defaults to: nil)

    The underlying error

  • attributes (Hash{Symbol => String})


27
28
29
30
31
32
33
# File 'lib/simple_jsonapi/errors/wrapped_error.rb', line 27

def initialize(cause = nil, **attributes)
  self.cause = cause

  attributes.each do |name, value|
    send("#{name}=", value) if respond_to?("#{name}=")
  end
end

Instance Attribute Details

Returns:

  • (String)


23
# File 'lib/simple_jsonapi/errors/wrapped_error.rb', line 23

attr_accessor :cause, :id, :status, :code, :title, :detail, :source_pointer, :source_parameter, :about_link

#causeObject

The original error.

Returns:

  • (Object)


23
24
25
# File 'lib/simple_jsonapi/errors/wrapped_error.rb', line 23

def cause
  @cause
end

#codeString

Returns:

  • (String)


23
# File 'lib/simple_jsonapi/errors/wrapped_error.rb', line 23

attr_accessor :cause, :id, :status, :code, :title, :detail, :source_pointer, :source_parameter, :about_link

#detailString

Returns:

  • (String)


23
# File 'lib/simple_jsonapi/errors/wrapped_error.rb', line 23

attr_accessor :cause, :id, :status, :code, :title, :detail, :source_pointer, :source_parameter, :about_link

#idString

Returns:

  • (String)


23
# File 'lib/simple_jsonapi/errors/wrapped_error.rb', line 23

attr_accessor :cause, :id, :status, :code, :title, :detail, :source_pointer, :source_parameter, :about_link

#source_parameterString

Returns:

  • (String)


23
# File 'lib/simple_jsonapi/errors/wrapped_error.rb', line 23

attr_accessor :cause, :id, :status, :code, :title, :detail, :source_pointer, :source_parameter, :about_link

#source_pointerString

Returns:

  • (String)


23
# File 'lib/simple_jsonapi/errors/wrapped_error.rb', line 23

attr_accessor :cause, :id, :status, :code, :title, :detail, :source_pointer, :source_parameter, :about_link

#statusString

Returns:

  • (String)


23
# File 'lib/simple_jsonapi/errors/wrapped_error.rb', line 23

attr_accessor :cause, :id, :status, :code, :title, :detail, :source_pointer, :source_parameter, :about_link

#titleString

Returns:

  • (String)


23
# File 'lib/simple_jsonapi/errors/wrapped_error.rb', line 23

attr_accessor :cause, :id, :status, :code, :title, :detail, :source_pointer, :source_parameter, :about_link