I am developing an application where I have to read a CSV file. This file is the basis for further analysis. Unfortunately my program isn't the only one who is trying to read from this specific file. I suppose that's why I get the following error:
Error: EBUSY: resource busy or locked, open 'foo_bar.csv'
This error occurs rarely - let's say one time a day - but the time between failures seems to be random. But that's not the point.
I am using the node-red watch module to recognise any chances on the file. The watch module is followed by some functions, which are not touching the file. Then I am using the csvtojson module from "node-red-contrib-csvtojson". this is the only module touching the file directly. I am loading the content of the file into a JavaScript object and I am working only with this object. When the error occurs node-red crashes and is exited. I have to restart node red manuelly.
So here is my question: how can I catch this error so that the Programm doesn't crash? Ideally the flow would take a short break and try's the hole thing again some seconds later. The error catching module from node red is not working on this particular error
Thank you very mutch.
Michael