Added error check inside pass.json reading block

This commit is contained in:
alexandercerutti
2018-07-20 15:11:41 +02:00
parent 2e5e1eb278
commit ee5e1801f0

View File

@@ -113,7 +113,17 @@ class Pass {
// Otherwise would had to put everything in editPassStructure's Promise .then(). // Otherwise would had to put everything in editPassStructure's Promise .then().
async.parallel([ async.parallel([
passCallback => { passCallback => {
fs.readFile(path.resolve(this.modelDirectory, `${this.modelName}.pass`, "pass.json"), {}, (err, passStructBuffer) => { fs.readFile(path.resolve(computedModelPath, "pass.json"), {}, (err, passStructBuffer) => {
if (err) {
// Flow should never enter in there since pass.json existence-check is already done above.
return passCallback({
status: false,
error: {
message: `Unable to read pass.json file @ ${computedModelPath}`
}
});
}
if (!this._validateType(passStructBuffer)) { if (!this._validateType(passStructBuffer)) {
return passCallback({ return passCallback({
status: false, status: false,