mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-03 14:32:24 +02:00
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:
parent
38e9cc11fd
commit
3604dc6984
|
@ -726,6 +726,9 @@ final class OneDriveApi
|
||||||
}
|
}
|
||||||
} catch (OneDriveException e) {
|
} catch (OneDriveException e) {
|
||||||
if (e.httpStatusCode == 400 || e.httpStatusCode == 401) {
|
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";
|
e.msg ~= "\nRefresh token invalid, use --logout to authorize the client again";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -305,7 +305,7 @@ final class SyncEngine
|
||||||
if (e.httpStatusCode == 401) {
|
if (e.httpStatusCode == 401) {
|
||||||
// HTTP request returned status code 401 (Unauthorized)
|
// HTTP request returned status code 401 (Unauthorized)
|
||||||
displayOneDriveErrorMessage(e.msg);
|
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
|
// Must exit here
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
@ -344,7 +344,7 @@ final class SyncEngine
|
||||||
if (e.httpStatusCode == 401) {
|
if (e.httpStatusCode == 401) {
|
||||||
// HTTP request returned status code 401 (Unauthorized)
|
// HTTP request returned status code 401 (Unauthorized)
|
||||||
displayOneDriveErrorMessage(e.msg);
|
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
|
// Must exit here
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue