friendly errors if a non-existent gem install is tried

This commit is contained in:
Mitchell Hashimoto 2014-01-05 16:57:51 -08:00
parent fe8842c795
commit eabc0f04fa
3 changed files with 9 additions and 0 deletions

View File

@ -428,6 +428,10 @@ module Vagrant
error_key(:plugin_gem_error) error_key(:plugin_gem_error)
end end
class PluginGemNotFound < VagrantError
error_key(:plugin_gem_not_found)
end
class PluginInstallBadEntryPoint < VagrantError class PluginInstallBadEntryPoint < VagrantError
error_key(:plugin_install_bad_entry_point) error_key(:plugin_install_bad_entry_point)
end end

View File

@ -40,6 +40,8 @@ module Vagrant
@global_file.add_plugin(result.name) @global_file.add_plugin(result.name)
result result
rescue ::Bundler::GemNotFound
raise Errors::PluginGemNotFound, name: name
end end
# Uninstalls the plugin with the given name. # Uninstalls the plugin with the given name.

View File

@ -474,6 +474,9 @@ en:
manage Vagrant plugins. The output of the errors are shown below: manage Vagrant plugins. The output of the errors are shown below:
%{output} %{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: |- plugin_install_bad_entry_point: |-
Attempting to load the plugin '%{name}' failed, because Attempting to load the plugin '%{name}' failed, because
the entry point doesn't exist. The entry point attempted was the entry point doesn't exist. The entry point attempted was