diff --git a/src/backuptask.js b/src/backuptask.js index ca0c0b794..f4d974061 100644 --- a/src/backuptask.js +++ b/src/backuptask.js @@ -229,7 +229,11 @@ async function copy(backupConfig, srcRemotePath, destRemotePath, progressCallbac const newFilePath = backupFormat.api(format).getBackupFilePath(backupConfig, destRemotePath); const startTime = new Date(); - await safe(storage.api(provider).copy(backupConfig, oldFilePath, newFilePath, progressCallback)); + const [copyError] = await safe(storage.api(provider).copy(backupConfig, oldFilePath, newFilePath, progressCallback)); + if (copyError) { + debug(`copy: copied to ${destRemotePath} errored. error: ${copyError.message}`); + throw copyError; + } debug(`copy: copied successfully to ${destRemotePath}. Took ${(new Date() - startTime)/1000} seconds`); } diff --git a/src/storage/s3.js b/src/storage/s3.js index 408c00147..12173e860 100644 --- a/src/storage/s3.js +++ b/src/storage/s3.js @@ -454,6 +454,7 @@ async function copy(apiConfig, oldFilePath, newFilePath, progressCallback) { })); progressCallback({ message: `Copied ${total} files with error: ${copyError}` }); + if (copyError) throw copyError; } async function remove(apiConfig, filename) {