Improves behavior when an error occurs during backup

This commit is contained in:
Kristian Knarvik 2021-09-27 23:19:52 +02:00
parent c26a3bc3b5
commit 65ede11ab5

View File

@ -15,6 +15,7 @@ import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;
@ -183,8 +184,9 @@ public class BackupUtil {
try {
alreadyCopied += backupFolder(srcFolder, destinationFolder, backupFileSize, alreadyCopied);
} catch (IOException e) {
e.printStackTrace();
gui.setStatus("Backup caused an error");
gui.showError("Backup caused an error: " + e.getMessage());
gui.logError(Arrays.toString(e.getStackTrace()));
BackupGUI.destroy();
backupRunning = false;
}
return alreadyCopied;