diff options
| author | Markus Reiter | 2017-06-11 02:00:59 +0200 |
|---|---|---|
| committer | Markus Reiter | 2017-06-13 17:14:28 +0200 |
| commit | 66ce57530150d05f52c552347ebb7c44679daf44 (patch) | |
| tree | a8e81126c6e2acff92b4baf43e0410e4e5e537c8 /Library/Homebrew/cask/lib/hbc/cli | |
| parent | 054ed10cb1ea2d64c39ba2a3208c14a33d31274d (diff) | |
| download | brew-66ce57530150d05f52c552347ebb7c44679daf44.tar.bz2 | |
🔨 Refactor Cask exceptions.
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/cli')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/edit.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/install.rb | 10 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/reinstall.rb | 5 |
3 files changed, 5 insertions, 12 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/edit.rb b/Library/Homebrew/cask/lib/hbc/cli/edit.rb index dec0fe36b..77238d209 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/edit.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/edit.rb @@ -12,7 +12,7 @@ module Hbc cask_path = CaskLoader.path(cask_token) unless cask_path.exist? - raise CaskUnavailableError, %Q(#{cask_token}, run "brew cask create #{cask_token}" to create a new Cask) + raise CaskUnavailableError.new(cask_token, "Run #{Formatter.identifier("brew cask create #{cask_token}")} to create a new Cask.") end odebug "Opening editor for Cask #{cask_token}" diff --git a/Library/Homebrew/cask/lib/hbc/cli/install.rb b/Library/Homebrew/cask/lib/hbc/cli/install.rb index 4d0abc677..4ac98d1de 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/install.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/install.rb @@ -31,14 +31,8 @@ module Hbc rescue CaskAlreadyInstalledError => e opoo e.message count += 1 - rescue CaskAlreadyInstalledAutoUpdatesError => e - opoo e.message - count += 1 rescue CaskUnavailableError => e self.class.warn_unavailable_with_suggestion cask_token, e - rescue CaskNoShasumError => e - opoo e.message - count += 1 rescue CaskError => e onoe e.message end @@ -51,9 +45,9 @@ module Hbc exact_match, partial_matches = Search.search(cask_token) error_message = e.message if exact_match - error_message.concat(". Did you mean:\n#{exact_match}") + error_message.concat(" Did you mean:\n#{exact_match}") elsif !partial_matches.empty? - error_message.concat(". Did you mean one of:\n") + error_message.concat(" Did you mean one of:\n") .concat(Formatter.columns(partial_matches.take(20))) end onoe error_message diff --git a/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb b/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb index eb5f45c90..d90317892 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb @@ -17,9 +17,8 @@ module Hbc count += 1 rescue CaskUnavailableError => e self.class.warn_unavailable_with_suggestion cask_token, e - rescue CaskNoShasumError => e - opoo e.message - count += 1 + rescue CaskError => e + onoe e.message end end |
