Merge pull request #122 from Dahlgren/bugfix/missions-error

Handle errors while loading missions list
This commit is contained in:
Björn Dahlgren 2018-10-08 23:23:13 +02:00 committed by GitHub
commit 59b9c15869
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,14 +27,20 @@ Missions.prototype.updateMissions = function (cb) {
var self = this
fs.readdir(this.missionsPath(), function (err, files) {
if (err) {
console.log(err)
if (cb) {
cb(err)
return cb(err)
}
} else {
return
}
async.map(files, function (filename, cb) {
fs.stat(self.missionPath(filename), function (err, stat) {
if (err) {
cb(err)
console.log(err)
return cb(err)
}
cb(null, {
@ -55,7 +61,6 @@ Missions.prototype.updateMissions = function (cb) {
cb(err, missions)
}
})
}
})
}