diff --git a/Govt-Billing-React/src/firebase/firestore.ts b/Govt-Billing-React/src/firebase/firestore.ts index bf8cd1b..e6f2c96 100644 --- a/Govt-Billing-React/src/firebase/firestore.ts +++ b/Govt-Billing-React/src/firebase/firestore.ts @@ -79,6 +79,9 @@ const downloadFileFromFirebase = async (userId, key, onSuccess) => { const local = new Local(); const getFile = async () => { const docSnapshot = await getDoc(doc(db, "invoices", `${userId}-${key}`)); + if (!docSnapshot.exists()) { + throw new Error("File not found on the server. It may have been deleted."); + } const data = docSnapshot.data(); delete data["owner"]; return data;