-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mooli Tayer
committed
Jan 25, 2018
1 parent
8098547
commit 886d292
Showing
4 changed files
with
20 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,20 @@ | ||
# 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 | ||
module Kubeclient | ||
# Exception that is raised when a http request fails | ||
class HttpError < StandardError | ||
attr_reader :error_code, :message, :response | ||
|
||
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}" | ||
def initialize(error_code, message, response) | ||
@error_code = error_code | ||
@message = message | ||
@response = response | ||
end | ||
string | ||
end | ||
end | ||
|
||
module Kubeclient | ||
# Exception that is raised when a http request fails | ||
class HttpError < KubeException | ||
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 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
module Kubeclient | ||
# Exception that is raised when an http resource is not found | ||
class ResourceNotFoundError < HttpError | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters