So in my cloud function I have this snippet of code:
return users_pending_update.once('value').then((snapshot) => {
if (snapshot.exists()) {
return manage(ref_date, zonesYetToBeUpdated, snapshot);
} else {
return users_tzs_ref.once('value').then((snapshot) => {
if (snapshot.exists()) {
return manage(ref_date, zonesYetToBeUpdated, snapshot);
} else {
return null;
}
}).catch((error) => {
console.error("Getting the list of values from the \"users_tzs\" node failed with error: " + error);
});
}
}).catch((error) => {
console.error("Getting the list of values from the \"users_pending_update\" node failed with error: " + error);
});
My question is about the return null statement you can see in the code. The only reason I have it there is because I was getting a warning that not all code paths returned a value. I don't need or care about that path over there. The warning also goes away if I use something like return Promise.reject("text"). Will it be a problem if I leave it as return null and if yes what should I change it to?