Exception: KubeException

Inherits:
StandardError
  • Object
show all
Defined in:
lib/kubeclient/http_error.rb

Overview

TODO: remove this on next major version bump Deprected http exception

Direct Known Subclasses

Kubeclient::HttpError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error_code, message, response) ⇒ KubeException

Returns a new instance of KubeException.



8
9
10
11
12
# File 'lib/kubeclient/http_error.rb', line 8

def initialize(error_code, message, response)
  @error_code = error_code
  @message = message
  @response = response
end

Instance Attribute Details

#error_codeObject (readonly)

Returns the value of attribute error_code.



6
7
8
# File 'lib/kubeclient/http_error.rb', line 6

def error_code
  @error_code
end

#messageObject (readonly)

Returns the value of attribute message.



6
7
8
# File 'lib/kubeclient/http_error.rb', line 6

def message
  @message
end

#responseObject (readonly)

Returns the value of attribute response.



6
7
8
# File 'lib/kubeclient/http_error.rb', line 6

def response
  @response
end

Instance Method Details

#to_sObject



14
15
16
17
18
19
20
# File 'lib/kubeclient/http_error.rb', line 14

def to_s
  string = "HTTP status code #{@error_code}, #{@message}"
  if @response.is_a?(RestClient::Response) && @response.request
    string += " for #{@response.request.method.upcase} #{@response.request.url}"
  end
  string
end