I have a Google script deployed as webapp, which I launch in the Chrome browser and every 5 minutes makes a callback to a function that runs on the server.
This function performs tasks with files stored in Drive and returns a result to the client.
The problem is that sporadically there is an exception that stops the webapp, and you have to restart it.
The error that is displayed in the console is: "Failed to load resource: net :: ERR_EMPTY_RESPONSE" and then the error: "Uncaught NetworkError: Connection error due to HTTP 0"
The network on which the client runs has a proxy.
I would need to know how I can capture this exception from JS so that the application does not crack and try again.
I've tried to put the code in a try-catch block but the exception is not caught.
I add the function code:
function request FileSync () {
// Disables planning until the process is finished.
clearInterval (scheduler);
plannerActivated = false;
var now = getClientDate ();
if (navigator.onLine) {
try {
google.script.run.withSuccessHandler (ackProcesarTareasSync) .procesarTareasSync (now);
}
catch (e) {
ackProcessSyncTasks ([false, e.toString ()]);
}
}
else {
ackProcessingSyncTags ([true, "No Internet connection, it is retried later ..."]);
}
}