Skip to content

Commit

Permalink
fix: box ureq error to reduce enum size (#9)
Browse files Browse the repository at this point in the history
* fix: box ureq error to reduce enum size

* test: make single-threaded for consistency
  • Loading branch information
kade-robertson authored Jan 20, 2023
1 parent 9b4aad7 commit 0f48023
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
shared-key: 'cache'

- name: Test
run: cargo test
run: cargo test -- --test-threads 1
7 changes: 4 additions & 3 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub enum DDragonClientError {
#[error("Could not parse URL.")]
UrlParse(#[from] url::ParseError),
#[error("Could not complete request.")]
Request(#[from] ureq::Error),
Request(#[from] Box<ureq::Error>),
#[error("Could not parse JSON data.")]
Parse(#[from] std::io::Error),
#[error("Could not parse JSON data.")]
Expand All @@ -36,7 +36,8 @@ impl DDragonClient {
) -> Result<Self, DDragonClientError> {
let version_list = agent
.get(base_url.join("/api/versions.json")?.as_str())
.call()?
.call()
.map_err(Box::new)?
.into_json::<Vec<String>>()?;

let latest_version = version_list
Expand Down Expand Up @@ -91,7 +92,7 @@ impl DDragonClient {
}
}

let response = self.agent.get(request_url).call()?;
let response = self.agent.get(request_url).call().map_err(Box::new)?;
let response_str = response.into_string()?;
let response_json = serde_json::from_str(&response_str)?;

Expand Down

0 comments on commit 0f48023

Please sign in to comment.