Skip to content

Commit

Permalink
Fix NoMethodError: undefined method []' for nil:NilClass`
Browse files Browse the repository at this point in the history
`@response` can be `nil`.
  • Loading branch information
andrzej-stencel committed Nov 24, 2020
1 parent 10c3e85 commit 7de1209
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/kubeclient/http_error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def initialize(error_code, message, response) # rubocop:disable Lint/MissingSupe

def to_s
string = "HTTP status code #{@error_code}, #{@message}"
if @response[:request]
if @response && @response[:request]
request_method = @response[:request][:method]&.to_s&.upcase
request_path = @response[:request][:url_path]
string += " for #{request_method} #{request_path}"
Expand Down

0 comments on commit 7de1209

Please sign in to comment.