Exception: VaultApi::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/vault_api/error.rb

Instance Method Summary collapse

Constructor Details

#initialize(e) ⇒ Error

Returns a new instance of Error.



5
6
7
8
9
10
11
12
13
14
# File 'lib/vault_api/error.rb', line 5

def initialize(e)
  @wrapped_exception = nil

  if e.respond_to?(:backtrace)
    super(e.message)
    @wrapped_exception = e
  else
    super(e.to_s)
  end
end

Instance Method Details

#backtraceObject



16
17
18
19
20
21
22
# File 'lib/vault_api/error.rb', line 16

def backtrace
  if @wrapped_exception
    @wrapped_exception.backtrace
  else
    super
  end
end

#inspectObject



24
25
26
27
28
29
# File 'lib/vault_api/error.rb', line 24

def inspect
  inner = ''
  inner << " wrapped=#{@wrapped_exception.inspect}" if @wrapped_exception
  inner << " #{super}" if inner.empty?
  %(#<#{self.class}#{inner}>)
end