How to handle errors in scheduled functions and display that error to the frontend?
It then calls a scheduled function which creates chunks from the youtube url.
After creating the chunks, another scheduled function is called which generates the embeddings from the chunks and then adds it to the vector database and updates the "chatbook" table saying that the embeddings has been generated.
Till the embeddings is being generating, a loading spinner is displayed in the frontend. And as soon as the table updates that the embedding has been generated, the chatbot is shown.
So, the problem I am facing is if there is an error in the
createChunks action even then the loading spinner is being displayed in the frontend. The error is being caught but I cannot figure out how can I show that error to the frontend. What would be the efficient way to handle and display errors in such cases?If I am unable to explain my situation, then please feel free to further ask any questions regarding the same.
