Exception: K8s::Error::API

Inherits:
K8s::Error show all
Extended by:
Forwardable
Defined in:
lib/k8s/error.rb

Constant Summary

Constants inherited from K8s::Error

HTTP_STATUS_ERRORS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from K8s::Error

define_status_error

Constructor Details

#initialize(method, path, code, reason, status = nil) ⇒ API

Returns a new instance of API.

Parameters:

  • method (Integer)

    HTTP request method

  • path (Integer)

    HTTP request path

  • code (Integer)

    HTTP response code

  • reason (String)

    HTTP response reason

  • status (K8s::API::MetaV1::Status) (defaults to: nil)


15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/k8s/error.rb', line 15

def initialize(method, path, code, reason, status = nil)
  @method = method
  @path = path
  @code = code
  @reason = reason
  @status = status

  if status
    super("#{@method} #{@path} => HTTP #{@code} #{@reason}: #{@status.message}")
  else
    super("#{@method} #{@path} => HTTP #{@code} #{@reason}")
  end
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



8
9
10
# File 'lib/k8s/error.rb', line 8

def code
  @code
end

#methodObject (readonly)

Returns the value of attribute method.



8
9
10
# File 'lib/k8s/error.rb', line 8

def method
  @method
end

#pathObject (readonly)

Returns the value of attribute path.



8
9
10
# File 'lib/k8s/error.rb', line 8

def path
  @path
end

#reasonObject (readonly)

Returns the value of attribute reason.



8
9
10
# File 'lib/k8s/error.rb', line 8

def reason
  @reason
end

#statusObject (readonly)

Returns the value of attribute status.



8
9
10
# File 'lib/k8s/error.rb', line 8

def status
  @status
end