Skip to content

Commit

Permalink
Run
Browse files Browse the repository at this point in the history
  • Loading branch information
Tokarak committed Feb 1, 2024
1 parent bd8feb6 commit d851b90
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,13 @@ pub async fn json(path: String, quarantine: bool) -> Result<Value, String> {
let json: Value = value;
// If Reddit returned an error
if json["error"].is_i64() {
if json["message"] == "Unauthorized" { // OAuth token has expired
if json["message"] == "Unauthorized" {
// OAuth token has expired
error!("Forcing a token refresh");
let () = force_refresh_token().await;
return Err("OAuth token has expired. Please refresh the page!".to_string())
return Err("OAuth token has expired. Please refresh the page!".to_string());
}
Err(format!("Reddit error {} \"{}\": {}", json["error"], json["reason"], json["message"]))

} else {
Ok(json)
}
Expand Down

0 comments on commit d851b90

Please sign in to comment.