10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/xenapi/dispatcher.rb', line 10
def method_missing(name, *args)
begin
response = @proxy.send(name, *args)
raise XenAPI::ErrorFactory.create(*response['ErrorDescription']) unless response['Status'] == 'Success'
response['Value']
rescue Exception => exc
error = XenAPI::ErrorFactory.wrap(exc)
if @error_callback
@error_callback.call(error) do |new_session|
prefix = @proxy.prefix.delete(".").to_sym
dispatcher = new_session.send(prefix)
dispatcher.send(name, *args)
end
else
raise error
end
end
end
|