Skip to content

Commit

Permalink
Merge pull request #124 from ComputerDruid/error
Browse files Browse the repository at this point in the history
Add basic error handling to GraphQL query
  • Loading branch information
tmandry authored Feb 27, 2023
2 parents a51ce4e + 342b01b commit cb33e1b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,19 @@ fn get_issues_by_milestone(version: &str, repo_name: &'static str) -> Vec<json::

let client = Client::new();

let json = client
let response = client
.post("https://api.github.com/graphql")
.headers(headers.clone())
.body(json_query)
.send()
.unwrap()
.unwrap();
let status = response.status();
let json = response
.json::<json::Value>()
.unwrap();
if !status.is_success() {
panic!("API Error {}: {}", status, json);
}

let milestones_data = json["data"]["repository"]["milestones"].clone();
assert_eq!(
Expand Down

0 comments on commit cb33e1b

Please sign in to comment.