Added more meaningful error messages

pull/1/head
Piero Toffanin 2017-01-24 08:15:43 -05:00
rodzic 088b78e687
commit 72c5e8864d
3 zmienionych plików z 9 dodań i 2 usunięć

Wyświetl plik

@ -530,5 +530,6 @@ async.series([
});
}
], err => {
debugger;
if (err) logger.error("Error during startup: " + err.message);
});

Wyświetl plik

@ -105,7 +105,13 @@ module.exports = class TaskManager{
restoreTaskListFromDump(done){
fs.readFile(TASKS_DUMP_FILE, (err, data) => {
if (!err){
let tasks = JSON.parse(data.toString());
let tasks;
try{
tasks = JSON.parse(data.toString());
}catch(e){
done(new Error(`Could not load task list. It looks like the ${TASKS_DUMP_FILE} is corrupted (${e.message}). Please manually delete the file and try again.`));
return;
}
async.each(tasks, (taskJson, done) => {
Task.CreateFromSerialized(taskJson, (err, task) => {

Wyświetl plik

@ -111,7 +111,7 @@ module.exports = {
let json = JSON.parse(output.join(""));
done(null, json);
}catch(err){
done(err);
done(new Error(`Could not load list of options from OpenDroneMap. Is OpenDroneMap installed in ${config.odm_path}? Make sure that OpenDroneMap is installed and that --odm_path is set properly: ${err.message}`));
}
})
.on('error', done);