Expose the exception which triggers recovery methods through the "vagrant.error" environmental hash
This commit is contained in:
parent
d5ad387f27
commit
7c42300002
|
@ -23,7 +23,9 @@ module Vagrant
|
||||||
raise Errors::VagrantInterrupt.new if env.interrupted?
|
raise Errors::VagrantInterrupt.new if env.interrupted?
|
||||||
@stack.unshift(@actions.shift).first.call(env)
|
@stack.unshift(@actions.shift).first.call(env)
|
||||||
raise Errors::VagrantInterrupt.new if env.interrupted?
|
raise Errors::VagrantInterrupt.new if env.interrupted?
|
||||||
rescue
|
rescue Exception => e
|
||||||
|
env["vagrant.error"] = e
|
||||||
|
|
||||||
# Something went horribly wrong. Start the rescue chain then
|
# Something went horribly wrong. Start the rescue chain then
|
||||||
# reraise the exception to properly kick us out of limbo here.
|
# reraise the exception to properly kick us out of limbo here.
|
||||||
begin_rescue(env)
|
begin_rescue(env)
|
||||||
|
|
|
@ -63,7 +63,10 @@ class ActionWardenTest < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
@instance.actions << Foo.new
|
@instance.actions << Foo.new
|
||||||
@instance.expects(:begin_rescue)
|
@instance.expects(:begin_rescue).with() do |env|
|
||||||
|
assert env["vagrant.error"].is_a?(RuntimeError)
|
||||||
|
true
|
||||||
|
end
|
||||||
assert_raises(RuntimeError) { @instance.call(new_env) }
|
assert_raises(RuntimeError) { @instance.call(new_env) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue