Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gems/kubeclient/lib/kubeclient/http_error.rb')
-rw-r--r--vendor/gems/kubeclient/lib/kubeclient/http_error.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/vendor/gems/kubeclient/lib/kubeclient/http_error.rb b/vendor/gems/kubeclient/lib/kubeclient/http_error.rb
new file mode 100644
index 00000000000..121368c2f17
--- /dev/null
+++ b/vendor/gems/kubeclient/lib/kubeclient/http_error.rb
@@ -0,0 +1,25 @@
+# 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