Skip to content

Commit

Permalink
Show error log only when there was actually an exception (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
jckleiner committed Dec 24, 2023
1 parent 1dfb34e commit 1c1febf
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/main/java/com/greydev/notionbackup/NotionBackup.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,32 +73,40 @@ public static void main(String[] args) {
CompletableFuture<Void> futureGoogleDrive = CompletableFuture
.runAsync(() -> NotionBackup.startGoogleDriveBackup(exportedFile))
.handle((result, ex) -> {
if (ex != null) { hasErrorOccurred.set(true); }
log.error("Exception while GoogleDrive upload", ex);
if (ex != null) {
log.error("Exception while GoogleDrive upload", ex);
hasErrorOccurred.set(true);
}
return null;
});

CompletableFuture<Void> futureDropbox = CompletableFuture
.runAsync(() -> NotionBackup.startDropboxBackup(exportedFile))
.handle((result, ex) -> {
if (ex != null) { hasErrorOccurred.set(true); }
log.error("Exception while Dropbox upload", ex);
if (ex != null) {
hasErrorOccurred.set(true);
log.error("Exception while Dropbox upload", ex);
}
return null;
});

CompletableFuture<Void> futureNextcloud = CompletableFuture
.runAsync(() -> NotionBackup.startNextcloudBackup(exportedFile))
.handle((result, ex) -> {
if (ex != null) { hasErrorOccurred.set(true); }
log.error("Exception while Nextcloud upload", ex);
if (ex != null) {
hasErrorOccurred.set(true);
log.error("Exception while Nextcloud upload", ex);
}
return null;
});

CompletableFuture<Void> futurePCloud = CompletableFuture
.runAsync(() -> NotionBackup.startPCloudBackup(exportedFile))
.handle((result, ex) -> {
if (ex != null) { hasErrorOccurred.set(true); }
log.error("Exception while Pcloud upload", ex);
if (ex != null) {
hasErrorOccurred.set(true);
log.error("Exception while Pcloud upload", ex);
}
return null;
});

Expand Down

0 comments on commit 1c1febf

Please sign in to comment.