Class: AMF::Values::ErrorMessage

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

Overview

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

Instance Attribute Summary collapse

Attributes inherited from AsyncMessage

#correlationId

Attributes inherited from AbstractMessage

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

Instance Method Summary collapse

Constructor Details

#initialize(message, exception) ⇒ ErrorMessage

Returns a new instance of ErrorMessage.



108
109
110
111
112
113
114
115
# File 'lib/amf/values/messages.rb', line 108

def initialize message, exception
  super message

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

Instance Attribute Details

#extendedDataObject

Extended data that will facilitate custom error processing on the client



93
94
95
# File 'lib/amf/values/messages.rb', line 93

def extendedData
  @extendedData
end

#faultCodeObject

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



97
98
99
# File 'lib/amf/values/messages.rb', line 97

def faultCode
  @faultCode
end

#faultDetailObject

Detailed description of what caused the error



100
101
102
# File 'lib/amf/values/messages.rb', line 100

def faultDetail
  @faultDetail
end

#faultStringObject

A simple description of the error



103
104
105
# File 'lib/amf/values/messages.rb', line 103

def faultString
  @faultString
end

#rootCauseObject

Optional “root cause” of the error



106
107
108
# File 'lib/amf/values/messages.rb', line 106

def rootCause
  @rootCause
end

Instance Method Details

#to_amf(serializer) ⇒ Object



117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/amf/values/messages.rb', line 117

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