Refresh OAuth on 401 only (#33)
This commit is contained in:
parent
03e267f02e
commit
3d2c936a9e
@ -336,8 +336,12 @@ pub async fn json(path: String, quarantine: bool) -> Result<Value, String> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("Got a bad response from reddit {e} - forcing a token refresh. Status code: {status}");
|
error!("Got a bad response from reddit {e}. Status code: {status}");
|
||||||
let () = force_refresh_token().await;
|
// Unauthorized; token expired
|
||||||
|
if status == 401 {
|
||||||
|
error!("Forcing a token refresh");
|
||||||
|
let () = force_refresh_token().await;
|
||||||
|
}
|
||||||
if status.is_server_error() {
|
if status.is_server_error() {
|
||||||
Err("Reddit is having issues, check if there's an outage".to_string())
|
Err("Reddit is having issues, check if there's an outage".to_string())
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user