Skip to content

Commit

Permalink
Return error if no transits in transit directions
Browse files Browse the repository at this point in the history
Related to jclarke0000#3
  • Loading branch information
qistoph committed May 20, 2019
1 parent 15d6c2a commit e7992bc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion node_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ module.exports = NodeHelper.create({
}
transitInfo.push({routeLabel: s.transit_details.line.short_name ? s.transit_details.line.short_name : s.transit_details.line.name, vehicle: s.transit_details.line.vehicle.type, arrivalTime: arrivalTime});
}
routeObj.transitInfo = transitInfo;
}

routeObj.transitInfo = transitInfo;
if (transitInfo.length <= 0) {
var travelModes = r.legs[0].steps.map(s => s.travel_mode).join(", ");
console.log("MMM-MyCommute: transit directrions does not contain any transits (" + travelModes + ")");
prediction.error = true;
}
}
routeList.push(routeObj);
Expand Down

0 comments on commit e7992bc

Please sign in to comment.