diff --git a/lib/vagrant/errors.rb b/lib/vagrant/errors.rb index 754b29a73..ca0a0b9bf 100644 --- a/lib/vagrant/errors.rb +++ b/lib/vagrant/errors.rb @@ -192,6 +192,10 @@ module Vagrant error_key(:box_not_found_with_provider) end + class BoxNotFoundWithProviderAndVersion < VagrantError + error_key(:box_not_found_with_provider_and_version) + end + class BoxProviderDoesntMatch < VagrantError error_key(:box_provider_doesnt_match) end diff --git a/plugins/commands/box/command/repackage.rb b/plugins/commands/box/command/repackage.rb index 545a3d4d4..a8df09159 100644 --- a/plugins/commands/box/command/repackage.rb +++ b/plugins/commands/box/command/repackage.rb @@ -23,9 +23,10 @@ module VagrantPlugins # Verify the box exists that we want to repackage box = @env.boxes.find(box_name, box_provider, "= #{box_version}") if !box - raise Vagrant::Errors::BoxNotFound, - :name => box_name, - :provider => box_provider + raise Vagrant::Errors::BoxNotFoundWithProviderAndVersion, + name: box_name, + provider: box_provider.to_s, + version: box_version end # Repackage the box diff --git a/templates/locales/en.yml b/templates/locales/en.yml index dae427750..36b833a29 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -443,6 +443,10 @@ en: the box are shown below: %{providers} + box_not_found_with_provider_and_version: |- + The box '%{name}' (v%{version}) with provider '%{provider}' + could not be found. Please double check and try again. You + can see all the boxes that are installed with `vagrant box list`. box_provider_doesnt_match: |- The box you attempted to add doesn't match the provider you specified.