Exception: DeltacloudVM::Client::BaseError

Inherits:
Error
  • Object
show all
Defined in:
lib/deltacloud_vm/client/base_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ BaseError

Returns a new instance of BaseError.



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/deltacloud_vm/client/base_error.rb', line 29

def initialize(opts={})
  if opts.is_a? Hash
    @server_backtrace = opts[:server_backtrace]
    @driver = opts[:driver]
    @provider = opts[:provider]
    @status = opts[:status]
    @original_error = opts[:original_error]
    super(opts[:message])
  else
    super(opts)
  end
end

Instance Attribute Details

#driverObject (readonly)

Returns the value of attribute driver.



24
25
26
# File 'lib/deltacloud_vm/client/base_error.rb', line 24

def driver
  @driver
end

#original_errorObject (readonly)

Returns the value of attribute original_error.



27
28
29
# File 'lib/deltacloud_vm/client/base_error.rb', line 27

def original_error
  @original_error
end

#providerObject (readonly)

Returns the value of attribute provider.



25
26
27
# File 'lib/deltacloud_vm/client/base_error.rb', line 25

def provider
  @provider
end

#server_backtraceObject (readonly)

Returns the value of attribute server_backtrace.



23
24
25
# File 'lib/deltacloud_vm/client/base_error.rb', line 23

def server_backtrace
  @server_backtrace
end

#statusObject (readonly)

Returns the value of attribute status.



26
27
28
# File 'lib/deltacloud_vm/client/base_error.rb', line 26

def status
  @status
end

Instance Method Details

#set_backtrace(backtrace) ⇒ Object

If the DeltacloudVM API server error response contain backtrace from server,then make this backtrace available as part of this exception backtrace



46
47
48
49
50
51
52
53
# File 'lib/deltacloud_vm/client/base_error.rb', line 46

def set_backtrace(backtrace)
  return super(backtrace) if @server_backtrace.nil?
  super([
    backtrace[0..3],
    "-------DeltacloudVM API backtrace-------",
    @server_backtrace.split[0..10],
  ].flatten)
end