Skip to content

Commit

Permalink
Log unexpected access token response (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbanchich authored Mar 26, 2023
1 parent 5fe27a4 commit aaabe16
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "shreddit"
version = "0.7.0"
version = "0.7.1"
edition = "2021"
authors = ["Andrew Banchich <[email protected]>"]
description = "Overwrite and delete your Reddit account history."
Expand Down
3 changes: 3 additions & 0 deletions src/access_token.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::cli::Config;
use reqwest::Client;
use serde::Deserialize;
use serde_json::Value;
use std::collections::HashMap;

pub async fn new_access_token(args: &Config, client: &Client) -> Result<String, String> {
Expand All @@ -24,6 +25,7 @@ pub async fn new_access_token(args: &Config, client: &Client) -> Result<String,
match res {
AccessTokenResponse::Success { access_token } => Ok(access_token),
AccessTokenResponse::Error { message, .. } => Err(message),
AccessTokenResponse::Unexpected(json) => Err(serde_json::to_string(&json).unwrap()),
}
}

Expand All @@ -38,4 +40,5 @@ enum AccessTokenResponse {
error: String,
message: String,
},
Unexpected(Value),
}
1 change: 1 addition & 0 deletions src/things/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ static LOREM_IPSUM: &str = "Lorem ipsum dolor sit amet, consectetur adipiscing e

#[derive(Debug)]
pub enum ShredditError {
#[allow(dead_code)]
RateLimited,
}

Expand Down

0 comments on commit aaabe16

Please sign in to comment.