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:
abraunegg 2020-02-12 06:16:38 +11:00 committed by GitHub
parent 1f6c568a44
commit fc6e2d9cfe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -291,6 +291,13 @@ final class SyncEngine
// Must exit here
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) {
// There was a HTTP 5xx Server Side Error
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
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) {
// There was a HTTP 5xx Server Side Error
log.error("ERROR: OneDrive returned a 'HTTP 5xx Server Side Error' - Cannot Initialize Sync Engine");
@ -376,6 +390,9 @@ final class SyncEngine
initDone = false;
// log why
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
exit(-1);
}