Exception: XenAPI::Failure

Inherits:
Exception
  • Object
show all
Defined in:
lib/xencap/xenapi.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(details = []) ⇒ Failure

Returns a new instance of Failure.



48
49
50
51
52
53
54
55
# File 'lib/xencap/xenapi.rb', line 48

def initialize(details = [])
  if details.is_a? Array
    @error_type = details[0]
    @error_details = details[1..-1] || []
  else
    @error_details = []
  end
end

Instance Attribute Details

#error_detailsObject (readonly)

Returns the value of attribute error_details.



67
68
69
# File 'lib/xencap/xenapi.rb', line 67

def error_details
  @error_details
end

#error_typeObject (readonly)

Returns the value of attribute error_type.



67
68
69
# File 'lib/xencap/xenapi.rb', line 67

def error_type
  @error_type
end

Instance Method Details

#to_sObject



57
58
59
60
61
62
63
64
65
# File 'lib/xencap/xenapi.rb', line 57

def to_s
  details = case @error_details.length
    when 0 then ""
    when 1 then @error_details[0]
    else @error_details.inspect
  end

  "#{@error_type.to_s}: #{details}"
end