Class: AMF::Messages::ErrorMessage

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

Overview

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

Instance Attribute Summary collapse

Attributes inherited from AsyncMessage

#correlation_id

Attributes inherited from AbstractMessage

#body, #client_id, #headers, #message_id, #time_to_live, #timestamp

Instance Method Summary collapse

Constructor Details

#initialize(message, exception) ⇒ ErrorMessage

Returns a new instance of ErrorMessage.



117
118
119
120
121
122
123
124
# File 'lib/amf/messages.rb', line 117

def initialize message, exception
  super message

  @e = exception
  @fault_code = @e.class.name
  @fault_detail = @e.backtrace.join("\n")
  @fault_string = @e.message
end

Instance Attribute Details

#extended_dataObject

Extended data that will facilitate custom error processing on the client



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

def extended_data
  @extended_data
end

#fault_codeObject

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



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

def fault_code
  @fault_code
end

#fault_detailObject

Detailed description of what caused the error



109
110
111
# File 'lib/amf/messages.rb', line 109

def fault_detail
  @fault_detail
end

#fault_stringObject

A simple description of the error



112
113
114
# File 'lib/amf/messages.rb', line 112

def fault_string
  @fault_string
end

#root_causeObject

Optional “root cause” of the error



115
116
117
# File 'lib/amf/messages.rb', line 115

def root_cause
  @root_cause
end

Instance Method Details

#to_amf(serializer) ⇒ Object



126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/amf/messages.rb', line 126

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