diff --git a/lib/capistrano/transfer.rb b/lib/capistrano/transfer.rb index c1b75e88..b9c8f693 100644 --- a/lib/capistrano/transfer.rb +++ b/lib/capistrano/transfer.rb @@ -203,6 +203,8 @@ module Capistrano end def handle_error(error) + raise error if error.message.include?('expected a file to upload') + transfer = session_map[error.session] transfer[:error] = error transfer[:failed] = true diff --git a/test/transfer_test.rb b/test/transfer_test.rb index f98c44b2..9fbeab81 100644 --- a/test/transfer_test.rb +++ b/test/transfer_test.rb @@ -133,6 +133,14 @@ class TransferTest < Test::Unit::TestCase transfer.process! end + def test_uploading_a_non_existing_file_should_raise_an_understandable_error + s = session('app1') + error = Capistrano::Processable::SessionAssociation.on(ArgumentError.new('expected a file to upload'), s) + transfer = Capistrano::Transfer.new(:up, "from", "to", [], :via => :scp) + transfer.expects(:process_iteration).raises(error) + assert_raise(ArgumentError, 'expected a file to upload') { transfer.process! } + end + private class ExceptionWithSession < ::Exception