Exception: Wamp::Client::Response::CallError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/wamp/client/response.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error, args = nil, kwargs = nil) ⇒ CallError

Returns a new instance of CallError.



82
83
84
85
86
# File 'lib/wamp/client/response.rb', line 82

def initialize(error, args=nil, kwargs=nil)
  @error = error
  @args = args || []
  @kwargs = kwargs || {}
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



80
81
82
# File 'lib/wamp/client/response.rb', line 80

def args
  @args
end

#errorObject (readonly)

Returns the value of attribute error.



80
81
82
# File 'lib/wamp/client/response.rb', line 80

def error
  @error
end

#kwargsObject (readonly)

Returns the value of attribute kwargs.



80
81
82
# File 'lib/wamp/client/response.rb', line 80

def kwargs
  @kwargs
end

Class Method Details

.ensure(result) ⇒ Object



100
101
102
103
104
105
106
107
# File 'lib/wamp/client/response.rb', line 100

def self.ensure(result)
  unless result.is_a?(self)
    args = result != nil ? [result] : nil
    result = self.new(DEFAULT_ERROR, args)
  end

  result
end

.from_hash(hash) ⇒ Object



88
89
90
# File 'lib/wamp/client/response.rb', line 88

def self.from_hash(hash)
  self.new(hash[:error], hash[:args], hash[:kwargs])
end

.from_message(msg) ⇒ Object



96
97
98
# File 'lib/wamp/client/response.rb', line 96

def self.from_message(msg)
  self.new(msg.error, msg.arguments, msg.argumentskw)
end

Instance Method Details

#to_hashObject



92
93
94
# File 'lib/wamp/client/response.rb', line 92

def to_hash
  { error: self.error, args: self.args, kwargs: self.kwargs }
end