Add notification to advise users when the client needs to be reauthenticated (#1046)

* Utilise errorAndNotify function to advise users when the client needs to be reauthenticated
This commit is contained in:
abraunegg 2020-09-25 06:42:44 +10:00 committed by GitHub
parent 38e9cc11fd
commit 3604dc6984
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -726,6 +726,9 @@ final class OneDriveApi
}
} catch (OneDriveException e) {
if (e.httpStatusCode == 400 || e.httpStatusCode == 401) {
// flag error and notify
log.errorAndNotify("\nERROR: Refresh token invalid, use --logout to authorize the client again.\n");
// set error message
e.msg ~= "\nRefresh token invalid, use --logout to authorize the client again";
}
}

View file

@ -305,7 +305,7 @@ final class SyncEngine
if (e.httpStatusCode == 401) {
// HTTP request returned status code 401 (Unauthorized)
displayOneDriveErrorMessage(e.msg);
log.error("\nERROR: Check your configuration as your refresh_token may be empty or invalid. You may need to issue a --logout and re-authorise this client.\n");
log.errorAndNotify("\nERROR: Check your configuration as your refresh_token may be empty or invalid. You may need to issue a --logout and re-authorise this client.\n");
// Must exit here
exit(-1);
}
@ -344,7 +344,7 @@ final class SyncEngine
if (e.httpStatusCode == 401) {
// HTTP request returned status code 401 (Unauthorized)
displayOneDriveErrorMessage(e.msg);
log.error("\nERROR: Check your configuration as your refresh_token may be empty or invalid. You may need to issue a --logout and re-authorise this client.\n");
log.errorAndNotify("\nERROR: Check your configuration as your refresh_token may be empty or invalid. You may need to issue a --logout and re-authorise this client.\n");
// Must exit here
exit(-1);
}