1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
# frozen_string_literal: true
# TODO: remove this on next major version bump
# Deprected http exception
class KubeException < StandardError
attr_reader :error_code, :message, :response
def initialize(error_code, message, response)
@error_code = error_code
@message = message
@response = response
end
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
end
module Kubeclient
# Exception that is raised when a http request fails
class HttpError < KubeException
end
end
|