Class: RocketAMF::Values::ErrorMessage

Inherits:
AcknowledgeMessage show all
Defined in:
lib/rocketamf/values/messages.rb

Overview

Maps to flex.messaging.messages.ErrorMessage in AMF3 mode

Constant Summary

Constants inherited from AcknowledgeMessage

AcknowledgeMessage::EXTERNALIZABLE_FIELDS

Constants inherited from AsyncMessage

AsyncMessage::EXTERNALIZABLE_FIELDS

Constants inherited from AbstractMessage

AbstractMessage::EXTERNALIZABLE_FIELDS

Instance Attribute Summary collapse

Attributes inherited from AsyncMessage

#correlationId

Attributes inherited from AbstractMessage

#body, #clientId, #destination, #headers, #messageId, #timeToLive, #timestamp

Instance Method Summary collapse

Methods inherited from AcknowledgeMessage

#read_external

Methods inherited from AsyncMessage

#correlationIdBytes=, #read_external

Methods inherited from AbstractMessage

#clientIdBytes=, #messageIdBytes=, #read_external

Constructor Details

#initialize(message = nil, exception = nil) ⇒ ErrorMessage

Returns a new instance of ErrorMessage.



189
190
191
192
193
194
195
196
197
198
# File 'lib/rocketamf/values/messages.rb', line 189

def initialize message=nil, exception=nil
  super message

  unless exception.nil?
    @e = exception
    @faultCode = @e.class.name
    @faultDetail = @e.backtrace.join("\n")
    @faultString = @e.message
  end
end

Instance Attribute Details

#extendedDataObject

Extended data that will facilitate custom error processing on the client



174
175
176
# File 'lib/rocketamf/values/messages.rb', line 174

def extendedData
  @extendedData
end

#faultCodeObject

The fault code for the error, which defaults to the class name of the causing exception



178
179
180
# File 'lib/rocketamf/values/messages.rb', line 178

def faultCode
  @faultCode
end

#faultDetailObject

Detailed description of what caused the error



181
182
183
# File 'lib/rocketamf/values/messages.rb', line 181

def faultDetail
  @faultDetail
end

#faultStringObject

A simple description of the error



184
185
186
# File 'lib/rocketamf/values/messages.rb', line 184

def faultString
  @faultString
end

#rootCauseObject

Optional “root cause” of the error



187
188
189
# File 'lib/rocketamf/values/messages.rb', line 187

def rootCause
  @rootCause
end

Instance Method Details

#encode_amf(serializer) ⇒ Object



200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/rocketamf/values/messages.rb', line 200

def encode_amf serializer
  if serializer.version == 0
    data = {
      :faultCode => @faultCode,
      :faultDetail => @faultDetail,
      :faultString => @faultString
    }
    serializer.write_object(data)
  else
    serializer.write_object(self)
  end
end