From eabc0f04fa0bbd0ecd85ce8022d7b9e0d8dbc8f8 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 5 Jan 2014 16:57:51 -0800 Subject: [PATCH] friendly errors if a non-existent gem install is tried --- lib/vagrant/errors.rb | 4 ++++ lib/vagrant/plugin/manager.rb | 2 ++ templates/locales/en.yml | 3 +++ 3 files changed, 9 insertions(+) diff --git a/lib/vagrant/errors.rb b/lib/vagrant/errors.rb index 938b4a9ac..f78dd9b63 100644 --- a/lib/vagrant/errors.rb +++ b/lib/vagrant/errors.rb @@ -428,6 +428,10 @@ module Vagrant error_key(:plugin_gem_error) end + class PluginGemNotFound < VagrantError + error_key(:plugin_gem_not_found) + end + class PluginInstallBadEntryPoint < VagrantError error_key(:plugin_install_bad_entry_point) end diff --git a/lib/vagrant/plugin/manager.rb b/lib/vagrant/plugin/manager.rb index 3986f1b79..7c67d4372 100644 --- a/lib/vagrant/plugin/manager.rb +++ b/lib/vagrant/plugin/manager.rb @@ -40,6 +40,8 @@ module Vagrant @global_file.add_plugin(result.name) result + rescue ::Bundler::GemNotFound + raise Errors::PluginGemNotFound, name: name end # Uninstalls the plugin with the given name. diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 7a4679e00..c8c900375 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -474,6 +474,9 @@ en: manage Vagrant plugins. The output of the errors are shown below: %{output} + plugin_gem_not_found: |- + The plugin '%{name}' could not be installed because it could not + be found. Please double check the name and try again. plugin_install_bad_entry_point: |- Attempting to load the plugin '%{name}' failed, because the entry point doesn't exist. The entry point attempted was