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.



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

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.



4
5
6
# File 'lib/kubeclient/http_error.rb', line 4

def error_code
  @error_code
end

#messageObject (readonly)

Returns the value of attribute message.



4
5
6
# File 'lib/kubeclient/http_error.rb', line 4

def message
  @message
end

#responseObject (readonly)

Returns the value of attribute response.



4
5
6
# File 'lib/kubeclient/http_error.rb', line 4

def response
  @response
end

Instance Method Details

#to_sObject



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

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