Exception: Vault::HTTPError

Inherits:
VaultError show all
Defined in:
lib/vault/errors.rb

Direct Known Subclasses

HTTPClientError, HTTPServerError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(address, response, errors = []) ⇒ HTTPError

Returns a new instance of HTTPError.


66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/vault/errors.rb', line 66

def initialize(address, response, errors = [])
  @address, @response, @errors = address, response, errors
  @code  = response.code.to_i
  errors = errors.map { |error| "  * #{error}" }

  super <<-EOH
The Vault server at `#{address}' responded with a #{code}.
Any additional information the server supplied is shown below:

#{errors.join("\n").rstrip}

Please refer to the documentation for help.
EOH
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.


64
65
66
# File 'lib/vault/errors.rb', line 64

def address
  @address
end

#codeObject (readonly)

Returns the value of attribute code.


64
65
66
# File 'lib/vault/errors.rb', line 64

def code
  @code
end

#errorsObject (readonly)

Returns the value of attribute errors.


64
65
66
# File 'lib/vault/errors.rb', line 64

def errors
  @errors
end

#responseObject (readonly)

Returns the value of attribute response.


64
65
66
# File 'lib/vault/errors.rb', line 64

def response
  @response
end