For in-game dialog, I like to use separate text files which I load through AJAX at the start of a level, save to an array, and then parse line by line.
This works perfectly 99.9% of the time.
But on very rare occasions, the requested text file simply won't load. For my current in-development game, I've added an "on any error" condition so that I can see if a request failure happens in the future, but given how rare and seemingly random the error is, it might be hard to test for. I might go months without seeing the error again.
Bearing in mind that my game is offline (NW.js) and that I'm not doing something silly with file names or weird file contents, my questions are:
1. What might cause a file requested through AJAX to return successfully most of the time, but occasionally fail?
2. Is there an alternative way to load text files that never results in failure?