Skip to content

Commit

Permalink
[243] fix error name and msg
Browse files Browse the repository at this point in the history
  • Loading branch information
zipofar committed Jul 19, 2023
1 parent 620984d commit 1574deb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/uffizzi/services/kubeconfig_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
require 'psych'

class KubeconfigService
class Invalid < StandardError
class InvalidKubeconfigError < StandardError
def initialize(file_path)
msg = "Kubeconfig is invalid by path '#{file_path}'"
msg = "Invalid kubeconfig at path '#{file_path}'"

super(msg)
end
Expand Down Expand Up @@ -46,7 +46,7 @@ def save_to_filepath(filepath, kubeconfig)
target_kubeconfig = File.exist?(real_file_path) ? Psych.safe_load(File.read(real_file_path)) : nil

if target_kubeconfig.present? && !valid_kubeconfig?(target_kubeconfig)
raise Invalid.new(filepath)
raise InvalidKubeconfigError.new(filepath)
end

new_kubeconfig = block_given? ? yield(target_kubeconfig) : merge(target_kubeconfig, kubeconfig)
Expand Down
2 changes: 1 addition & 1 deletion test/uffizzi/cli/cluster_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def test_update_kubeconfig_if_kubeconfig_path_has_invalid_file

File.write(@kubeconfig_path, kubeconfig_from_filesystem)

error = assert_raises(KubeconfigService::Invalid) do
error = assert_raises(KubeconfigService::InvalidKubeconfigError) do
@cluster.update_kubeconfig
end

Expand Down

0 comments on commit 1574deb

Please sign in to comment.