Clean up error handling with ufraw

Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
James Ketr 2018-09-08 19:42:30 -07:00
parent 41ef463799
commit aa8cfec2cc

View File

@ -242,14 +242,14 @@ function convertRawToJpg(path, file) {
path + "/" + file path + "/" + file
]); ]);
let error = ""; const stderr = [];
ufraw.stderr.on('data', function(data) { ufraw.stderr.on('data', function(data) {
error += data; stderr.push(data);
}); });
ufraw.on('exit', function(code, signal) { ufraw.on('exit', function(stderr, code, signal) {
if (signal || code != 0) { if (signal || code != 0) {
let error = "UFRAW for " + path + "/" + file + " returned an error: " + code + "\n" + signal + "\n" + error + "\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() {
return reject(error); return reject(error);
@ -264,7 +264,7 @@ function convertRawToJpg(path, file) {
return resolve(); return resolve();
}); });
}); });
}); }.bind(this, stderr));
}); });
}); });
} }