mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-10 09:46:40 +02:00
test for curl exception when checking online status (#117)
* Check for a curl exception when checking the online status of the client at startup
This commit is contained in:
parent
6a6e0079af
commit
6a5ab5607a
15
src/main.d
15
src/main.d
|
@ -2,6 +2,7 @@ import core.stdc.stdlib: EXIT_SUCCESS, EXIT_FAILURE;
|
|||
import core.memory, core.time, core.thread;
|
||||
import std.getopt, std.file, std.path, std.process, std.stdio, std.conv;
|
||||
import config, itemdb, monitor, onedrive, selective, sync, util;
|
||||
import std.net.curl: CurlException;
|
||||
static import log;
|
||||
|
||||
int main(string[] args)
|
||||
|
@ -62,7 +63,9 @@ int main(string[] args)
|
|||
bool skipSymlinks;
|
||||
// Add option for no remote delete
|
||||
bool noRemoteDelete;
|
||||
|
||||
// Are we able to reach the OneDrive Service
|
||||
bool online = false;
|
||||
|
||||
try {
|
||||
auto opt = getopt(
|
||||
args,
|
||||
|
@ -145,11 +148,13 @@ int main(string[] args)
|
|||
}
|
||||
|
||||
log.vlog("Initializing the OneDrive API ...");
|
||||
bool online = testNetwork();
|
||||
if (!online && !monitor) {
|
||||
log.error("No network connection");
|
||||
try {
|
||||
online = testNetwork();
|
||||
} catch (CurlException e) {
|
||||
// No network connection to OneDrive Service
|
||||
log.error("No network connection to Microsoft OneDrive Service");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize OneDrive, check for authorization
|
||||
auto onedrive = new OneDriveApi(cfg, debugHttp);
|
||||
|
|
Loading…
Reference in a new issue