Exception: CreateSend::CreateSendError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/createsend.rb

Overview

Represents a CreateSend API error. Contains specific data about the error.

Direct Known Subclasses

BadRequest, Unauthorized

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ CreateSendError

Returns a new instance of CreateSendError.



36
37
38
39
40
41
42
# File 'lib/createsend.rb', line 36

def initialize(data)
  @data = data
  # @data should contain Code, Message and optionally ResultData
  extra = @data.ResultData ? "\nExtra result data: #{@data.ResultData}" : ""
  super "The CreateSend API responded with the following error"\
        " - #{@data.Code}: #{@data.Message}#{extra}"
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



35
36
37
# File 'lib/createsend.rb', line 35

def data
  @data
end