diff --git a/src/provider/github.rs b/src/provider/github.rs index e5da055..4b78af1 100644 --- a/src/provider/github.rs +++ b/src/provider/github.rs @@ -56,7 +56,7 @@ impl Provider for GitHub { .get(&url) .headers(headers) .send() - .or_else(|e| Err(format!("Unable to connect to: {} ({})", url, e)))?; + .map_err(|e| format!("Unable to connect to: {} ({})", url, e))?; if res.status() != StatusCode::OK { if res.status() == StatusCode::UNAUTHORIZED { @@ -77,7 +77,7 @@ impl Provider for GitHub { } let projects: Vec = serde_json::from_reader(res) - .or_else(|e| Err(format!("Unable to parse response as JSON ({:?})", e)))?; + .map_err(|e| format!("Unable to parse response as JSON ({:?})", e))?; let mut mirrors: Vec = Vec::new(); diff --git a/src/provider/gitlab.rs b/src/provider/gitlab.rs index f8f52a3..7d02a9b 100644 --- a/src/provider/gitlab.rs +++ b/src/provider/gitlab.rs @@ -60,7 +60,7 @@ impl GitLab { .get(&url) .headers(headers.clone()) .send() - .or_else(|e| Err(format!("Unable to connect to: {} ({})", url, e)))?; + .map_err(|e| format!("Unable to connect to: {} ({})", url, e))?; debug!("HTTP Status Received: {}", res.status()); @@ -99,7 +99,7 @@ impl GitLab { }; let results_page: Vec = serde_json::from_reader(res) - .or_else(|e| Err(format!("Unable to parse response as JSON ({})", e)))?; + .map_err(|e| format!("Unable to parse response as JSON ({})", e))?; results.extend(results_page);