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.



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

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



172
173
174
# File 'lib/rocketamf/values/messages.rb', line 172

def extendedData
  @extendedData
end

#faultCodeObject

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



176
177
178
# File 'lib/rocketamf/values/messages.rb', line 176

def faultCode
  @faultCode
end

#faultDetailObject

Detailed description of what caused the error



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

def faultDetail
  @faultDetail
end

#faultStringObject

A simple description of the error



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

def faultString
  @faultString
end

#rootCauseObject

Optional “root cause” of the error



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

def rootCause
  @rootCause
end

Instance Method Details

#encode_amf(serializer) ⇒ Object



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

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