class MC2P::MC2PError

MC2P Error - class used to manage the exceptions related with mc2p library

Attributes

json_body[RW]
resource[RW]
resource_id[RW]

Public Class Methods

new(message = nil, json_body = nil, resource = nil, resource_id = nil) click to toggle source

Initializes an error Params:

message

Error type

json_body

Response from server

resource

Class resource used when the error raised

resource_id

Resource id requested when the error raised

Calls superclass method
# File lib/errors.rb, line 14
def initialize(message = nil, json_body = nil,
               resource = nil, resource_id = nil)
  super(message)

  @_message = message
  @json_body = json_body
  @resource = resource
  @resource_id = resource_id
end

Public Instance Methods

to_s() click to toggle source

Returns: Error type and response

# File lib/errors.rb, line 25
def to_s
  "#{@_message} #{@json_body}"
end