How to check if Spreadsheet didnt get data (OR if a Procedure didnt work)

I am creating a movie streaming app. At start I called database each time app opens. But then I got idea of storing data in TInyDB. It works well but sometimes, (1 in 10 times) No Data is there in app even if TinyDB has already stored data. (As I koded, TinyDB Should have stored initial data on first open).
I know Problem is complicated but the question to you guys is simple. How can I check if spreadsheet didnt get Data. OR If it is possible: How to check if a procedure didnt work. Because I think sometimes if app was not closed or opened correctly, some procedures dont work.
Please help. I have almost completed all koding. But this problem…

If you show What you have tried then we could help you with speedy solution