continue in monitor mode when sync timed out (#265)

* update handling of connection timeouts in monitor mode & allow application continue rather than exit
This commit is contained in:
Norbert Preining 2018-12-03 11:41:31 +09:00 committed by abraunegg
parent c24e4b0b1e
commit 9817104ca1
2 changed files with 10 additions and 5 deletions

View file

@ -382,10 +382,15 @@ int main(string[] args)
online = false; online = false;
} }
if (online) { if (online) {
performSync(sync, singleDirectory, downloadOnly, localFirst, uploadOnly); try {
if (!downloadOnly) { performSync(sync, singleDirectory, downloadOnly, localFirst, uploadOnly);
// discard all events that may have been generated by the sync if (!downloadOnly) {
m.update(false); // discard all events that may have been generated by the sync
m.update(false);
}
} catch (CurlException e) {
// TODO better check of type of exception from Curl
log.log("No network connection to Microsoft OneDrive Service, skipping sync");
} }
} }
// performSync complete, set lastCheckTime to current time // performSync complete, set lastCheckTime to current time

View file

@ -523,7 +523,7 @@ final class OneDriveApi
} catch (CurlException e) { } catch (CurlException e) {
// Potentially Timeout was reached on handle error // Potentially Timeout was reached on handle error
log.error("\nAccess to the Microsoft OneDrive service timed out - Internet connectivity issue?\n"); log.error("\nAccess to the Microsoft OneDrive service timed out - Internet connectivity issue?\n");
exit(-1); throw e;
} }
JSONValue json; JSONValue json;