return BackupsError on error

This commit is contained in:
Girish Ramakrishnan
2017-04-20 17:03:10 -07:00
parent a0c3a531b3
commit 77d23d6c15

View File

@@ -115,7 +115,7 @@ function restore(apiConfig, backupId, destination, callback) {
if (!fs.existsSync(sourceFilePath)) return callback(new BackupsError(BackupsError.NOT_FOUND, 'backup file does not exist'));
mkdirp(destination, function (error) {
if (error) return callback(error);
if (error) return callback(new BackupsError(BackupsError.INTERNAL_ERROR, error));
var fileStream = fs.createReadStream(sourceFilePath);
var decipher = crypto.createDecipher('aes-256-cbc', apiConfig.key || '');