mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-09 09:22:18 +02:00
Catch 429 HTTPS return code when query for oneDriveRootDetails fails (#796)
* Catch 429 HTTPS return code when query for oneDriveRootDetails fails & provide error feedback that this was the reason why application initialization failed
This commit is contained in:
parent
1f6c568a44
commit
fc6e2d9cfe
17
src/sync.d
17
src/sync.d
|
@ -291,6 +291,13 @@ final class SyncEngine
|
||||||
// Must exit here
|
// Must exit here
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
if (e.httpStatusCode == 429) {
|
||||||
|
// HTTP request returned status code 429 (Too Many Requests)
|
||||||
|
log.error("\nERROR: OneDrive returned a 'HTTP 429 - Too Many Requests' - Cannot Initialize Sync Engine");
|
||||||
|
log.error("ERROR: Please try to access OneDrive again later\n");
|
||||||
|
// Must exit here
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
if (e.httpStatusCode >= 500) {
|
if (e.httpStatusCode >= 500) {
|
||||||
// There was a HTTP 5xx Server Side Error
|
// There was a HTTP 5xx Server Side Error
|
||||||
log.error("ERROR: OneDrive returned a 'HTTP 5xx Server Side Error' - Cannot Initialize Sync Engine");
|
log.error("ERROR: OneDrive returned a 'HTTP 5xx Server Side Error' - Cannot Initialize Sync Engine");
|
||||||
|
@ -320,6 +327,13 @@ final class SyncEngine
|
||||||
// Must exit here
|
// Must exit here
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
if (e.httpStatusCode == 429) {
|
||||||
|
// HTTP request returned status code 429 (Too Many Requests)
|
||||||
|
log.error("\nERROR: OneDrive returned a 'HTTP 429 - Too Many Requests' - Cannot Initialize Sync Engine");
|
||||||
|
log.error("ERROR: Please try to access OneDrive again later\n");
|
||||||
|
// Must exit here
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
if (e.httpStatusCode >= 500) {
|
if (e.httpStatusCode >= 500) {
|
||||||
// There was a HTTP 5xx Server Side Error
|
// There was a HTTP 5xx Server Side Error
|
||||||
log.error("ERROR: OneDrive returned a 'HTTP 5xx Server Side Error' - Cannot Initialize Sync Engine");
|
log.error("ERROR: OneDrive returned a 'HTTP 5xx Server Side Error' - Cannot Initialize Sync Engine");
|
||||||
|
@ -376,6 +390,9 @@ final class SyncEngine
|
||||||
initDone = false;
|
initDone = false;
|
||||||
// log why
|
// log why
|
||||||
log.error("ERROR: Unable to query OneDrive to initialize application");
|
log.error("ERROR: Unable to query OneDrive to initialize application");
|
||||||
|
// Debug OneDrive Account details response
|
||||||
|
log.vdebug("OneDrive Account Details: ", oneDriveDetails);
|
||||||
|
log.vdebug("OneDrive Account Root Details: ", oneDriveRootDetails);
|
||||||
// Must exit here
|
// Must exit here
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue