Method: AgentXmpp::Xmpp::ErrorResponse#initialize

Defined in:
lib/agent_xmpp/xmpp/error_response.rb

#initialize(errorcondition = nil, text = nil) ⇒ ErrorResponse

.….….….….….….….….….….….….….….….….….….….….….….….….……



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/agent_xmpp/xmpp/error_response.rb', line 95

def initialize(errorcondition=nil, text=nil)
  if errorcondition.nil?
    super()
  else
    errortype = nil
    errorcode = nil
    @@Errors.each do |cond,type,code|
      if errorcondition == cond
        errortype = type
        errorcode = code
      end
    end
    raise ArgumentError, "Unknown error condition when initializing ErrorReponse" if errortype.nil? || errorcode.nil?
    super()
    self.error = errorcondition unless errorcondition.nil?
    self.type = errortype unless errortype.nil?
    self.code = errorcode unless errorcode.nil?
  end
  self.text = text unless text.nil?
end