Log an upload error closer to when it occurs

When there is an error returned from the Upload it is propagated back
to the main loop and may have additional log messages before the actual
error is displayed. This displays a log message close to where the error
actually occurred.
This commit is contained in:
Mark Peek 2013-07-17 18:17:46 -07:00
parent ebd14bb2df
commit 0403932315
1 changed files with 5 additions and 1 deletions

View File

@ -79,5 +79,9 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
}
defer f.Close()
return comm.Upload(p.config.Destination, f)
err = comm.Upload(p.config.Destination, f)
if err != nil {
ui.Error(fmt.Sprintf("Upload failed: %s", err))
}
return err
}