Merge pull request #96 from 0hAodha/notanerror
Fix false "error fetching live train data" error
This commit is contained in:
@ -20,8 +20,8 @@ exports.getStationData = functions.https.onRequest((request, response) => {
|
|||||||
// fetch the "stations" collection
|
// fetch the "stations" collection
|
||||||
admin.firestore().collection('stations').get().then((snapshot) => {
|
admin.firestore().collection('stations').get().then((snapshot) => {
|
||||||
if (snapshot.empty) {
|
if (snapshot.empty) {
|
||||||
functions.logger.log("Error fetching station data from Firestore")
|
functions.logger.log("Empty snapshot received when fetching station data from Firestore")
|
||||||
response.status(404).send({data: "Error fetching station data from Firestore"})
|
response.status(404).send({data: "Empty snapshot received when fetching station data from Firestore"})
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// iterate through each of the collection's documents
|
// iterate through each of the collection's documents
|
||||||
@ -185,8 +185,8 @@ exports.getLiveTrainData = functions.https.onRequest((request, response) => {
|
|||||||
// fetch the "liveTrainData" collection
|
// fetch the "liveTrainData" collection
|
||||||
admin.firestore().collection('liveTrainData').get().then((snapshot) => {
|
admin.firestore().collection('liveTrainData').get().then((snapshot) => {
|
||||||
if (snapshot.empty) {
|
if (snapshot.empty) {
|
||||||
functions.logger.log("Error fetching live train data from Firestore")
|
functions.logger.log("Empty snapshot received when fetching live train data from Firestore")
|
||||||
response.status(404).send({data: "Successfully fetched live train data from Firestore"});
|
response.status(404).send({data: "Empty snapshot received when fetching live train data from Firestore"});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// iterate through each of the collection's documents
|
// iterate through each of the collection's documents
|
||||||
|
@ -189,7 +189,7 @@ export default {
|
|||||||
const getTrainData = httpsCallable(functions, 'getLiveTrainData');
|
const getTrainData = httpsCallable(functions, 'getLiveTrainData');
|
||||||
getTrainData().then((response) => {
|
getTrainData().then((response) => {
|
||||||
try {
|
try {
|
||||||
if (!response.data) throw new Error("Error fetching live train data from the database")
|
if (!response.data) console.warn("No train data in response!");
|
||||||
var unorderedTrains = [];
|
var unorderedTrains = [];
|
||||||
var insights = {
|
var insights = {
|
||||||
"totalNumTrains": 0,
|
"totalNumTrains": 0,
|
||||||
|
@ -415,7 +415,7 @@ export default {
|
|||||||
const getTrainData = httpsCallable(functions, 'getLiveTrainData');
|
const getTrainData = httpsCallable(functions, 'getLiveTrainData');
|
||||||
getTrainData().then((response) => {
|
getTrainData().then((response) => {
|
||||||
try {
|
try {
|
||||||
if (!response.data) throw new Error("Error fetching live train data from the database")
|
if (!response.data) console.warn("No train data in response!");
|
||||||
var unorderedTrains = [];
|
var unorderedTrains = [];
|
||||||
var currentMessages = [];
|
var currentMessages = [];
|
||||||
var insights = {
|
var insights = {
|
||||||
|
Reference in New Issue
Block a user