SEBA-677 Pay attention to errors during file transfer

Change-Id: I0a864f47d543d517f2333b5341218f45b4d9b18e
diff --git a/commands/transfer.go b/commands/transfer.go
index 699a4f7..59be175 100644
--- a/commands/transfer.go
+++ b/commands/transfer.go
@@ -84,6 +84,9 @@
 	}
 
 	h, upload_result, err := UploadFile(conn, descriptor, local_name, uri, options.ChunkSize)
+	if err != nil {
+		return err
+	}
 
 	if upload_result.GetFieldByName("checksum").(string) != h.GetChecksum() {
 		return fmt.Errorf("Checksum mismatch, expected=%s, received=%s",
diff --git a/commands/transfer_handler.go b/commands/transfer_handler.go
index 91e46d3..cc18f1b 100644
--- a/commands/transfer_handler.go
+++ b/commands/transfer_handler.go
@@ -121,6 +121,9 @@
 	if err != nil {
 		return nil, nil, err
 	}
+	if h.Status.Err() != nil {
+		return nil, nil, h.Status.Err()
+	}
 	d, err := dynamic.AsDynamicMessage(h.Response)
 	if err != nil {
 		return nil, nil, err
@@ -156,5 +159,9 @@
 		return nil, err
 	}
 
+	if h.Status.Err() != nil {
+		return nil, h.Status.Err()
+	}
+
 	return h, err
 }