core: raise user-friendly errors if capabilities exception in Guest
This commit is contained in:
parent
23c08eae9c
commit
ba5400b89b
|
@ -32,6 +32,10 @@ module Vagrant
|
||||||
def detect!
|
def detect!
|
||||||
guest_name = @machine.config.vm.guest
|
guest_name = @machine.config.vm.guest
|
||||||
initialize_capabilities!(guest_name, @guests, @capabilities, @machine)
|
initialize_capabilities!(guest_name, @guests, @capabilities, @machine)
|
||||||
|
rescue Errors::CapabilityHostExplicitNotDetected => e
|
||||||
|
raise Errors::GuestExplicitNotDetected, value: e.extra_data[:value]
|
||||||
|
rescue Errors::CapabilityHostNotDetected
|
||||||
|
raise Errors::GuestNotDetected
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns the specified or detected guest type name.
|
# Returns the specified or detected guest type name.
|
||||||
|
|
|
@ -34,6 +34,18 @@ describe Vagrant::Guest do
|
||||||
|
|
||||||
subject.detect!
|
subject.detect!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "raises a user-friendly error if specified guest doesn't exist" do
|
||||||
|
machine.config.vm.stub(guest: :foo)
|
||||||
|
|
||||||
|
expect { subject.detect! }.
|
||||||
|
to raise_error(Vagrant::Errors::GuestExplicitNotDetected)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "raises a user-friendly error if auto-detected guest not found" do
|
||||||
|
expect { subject.detect! }.
|
||||||
|
to raise_error(Vagrant::Errors::GuestNotDetected)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#name" do
|
describe "#name" do
|
||||||
|
|
Loading…
Reference in New Issue