No need to catch action exception on downloaders. Converted to using proper environment errors.

This commit is contained in:
Mitchell Hashimoto 2010-07-24 09:18:10 -07:00
parent 05eec68bfb
commit eed81d64f0
3 changed files with 6 additions and 8 deletions

View File

@ -19,11 +19,9 @@ module Vagrant
def call(env)
@env = env
catch_action_exception(env) do
download if instantiate_downloader
end
download if instantiate_downloader
return if env.error?
@app.call(@env)
cleanup

View File

@ -9,7 +9,7 @@ module Vagrant
def prepare(source_url)
if !::File.file?(source_url)
raise Action::ActionException.new(:downloader_file_doesnt_exist, :source_url => source_url)
return env.error!(:downloader_file_doesnt_exist, :source_url => source_url)
end
end

View File

@ -9,9 +9,9 @@ class FileDownloaderTest < Test::Unit::TestCase
context "preparing" do
should "raise an exception if the file does not exist" do
File.expects(:file?).with(@uri).returns(false)
assert_raises(Vagrant::Action::ActionException) {
@downloader.prepare(@uri)
}
@downloader.prepare(@uri)
assert @downloader.env.error?
assert_equal :downloader_file_doesnt_exist, @downloader.env.error.first
end
end