Failures during scanning will now exit the app instead of hanging.

Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
James Ketr 2018-09-14 12:03:35 -07:00
parent 320b36c37d
commit 4228939b55

View File

@ -130,6 +130,9 @@ function scanDir(parent, path) {
if (stats.isDirectory()) { if (stats.isDirectory()) {
return scanDir(parent, filepath, stats).then(function(entry) { return scanDir(parent, filepath, stats).then(function(entry) {
return resolve(true); return resolve(true);
}).catch(function(error) {
console.warn("scanDir failed");
return reject(error);
}); });
} }
@ -154,6 +157,9 @@ function scanDir(parent, path) {
processQueue.push([ replacements.path, file, stats.mtime, parent ]); processQueue.push([ replacements.path, file, stats.mtime, parent ]);
} }
return resolve(true); return resolve(true);
}).catch(function(error) {
console.error("Sequelize.query failed");
return reject(error);
}); });
}); });
}); });
@ -168,6 +174,9 @@ function scanDir(parent, path) {
}).then(function() { }).then(function() {
return resolve(); return resolve();
}); });
}).catch(function(error) {
console.error("Processing 'tmp' failed");
return reject(error);
}); });
}); });
}); });
@ -255,6 +264,10 @@ function convertRawToJpg(path, file) {
let error = "UFRAW for " + path + "/" + file + " returned an error: " + code + "\n" + signal + "\n" + stderr.join("\n") + "\n"; let error = "UFRAW for " + path + "/" + file + " returned an error: " + code + "\n" + signal + "\n" + stderr.join("\n") + "\n";
console.error(error); console.error(error);
return moveCorrupt(path, file).then(function() { return moveCorrupt(path, file).then(function() {
console.warn("ufraw failed");
return reject(error);
}).catch(function(error) {
console.warn("moveCorrupt failed");
return reject(error); return reject(error);
}); });
} }
@ -266,6 +279,9 @@ function convertRawToJpg(path, file) {
} }
return resolve(); return resolve();
}); });
}).catch(function(error) {
console.warn("mkdirPromise failed");
return reject(error);
}); });
}.bind(this, stderr)); }.bind(this, stderr));
}); });
@ -285,9 +301,8 @@ function moveCorrupt(path, file) {
if (err) { if (err) {
console.error("Unable to move corrupt file: " + path + "/" + file); console.error("Unable to move corrupt file: " + path + "/" + file);
return reject(err); return reject(err);
} else {
return resolve();
} }
return resolve();
}); });
}); });
}); });