From 9817104ca11328cc0d2349302fb608284ed09498 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 3 Dec 2018 11:41:31 +0900 Subject: [PATCH] continue in monitor mode when sync timed out (#265) * update handling of connection timeouts in monitor mode & allow application continue rather than exit --- src/main.d | 13 +++++++++---- src/onedrive.d | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main.d b/src/main.d index 67559231..138a56e5 100644 --- a/src/main.d +++ b/src/main.d @@ -382,10 +382,15 @@ int main(string[] args) online = false; } if (online) { - performSync(sync, singleDirectory, downloadOnly, localFirst, uploadOnly); - if (!downloadOnly) { - // discard all events that may have been generated by the sync - m.update(false); + try { + performSync(sync, singleDirectory, downloadOnly, localFirst, uploadOnly); + if (!downloadOnly) { + // 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 diff --git a/src/onedrive.d b/src/onedrive.d index 3854be15..b2d95bf7 100644 --- a/src/onedrive.d +++ b/src/onedrive.d @@ -523,7 +523,7 @@ final class OneDriveApi } catch (CurlException e) { // Potentially Timeout was reached on handle error log.error("\nAccess to the Microsoft OneDrive service timed out - Internet connectivity issue?\n"); - exit(-1); + throw e; } JSONValue json;