Use Message::result_for for better error messages

Recently fixed in the `curl` crate, this'll allow getting the full and complete
error message for each transfer instead of just the error code.
This commit is contained in:
Alex Crichton 2018-09-17 11:44:48 -07:00
parent 304871c793
commit bc942919e3
2 changed files with 4 additions and 2 deletions

View file

@ -22,7 +22,7 @@ bytesize = "1.0"
crates-io = { path = "src/crates-io", version = "0.20" }
crossbeam-utils = "0.5"
crypto-hash = "0.3.1"
curl = { version = "0.4.15", features = ['http2'] }
curl = { version = "0.4.17", features = ['http2'] }
env_logger = "0.5.11"
failure = "0.1.2"
filetime = "0.2"

View file

@ -585,9 +585,11 @@ impl<'a, 'cfg> Downloads<'a, 'cfg> {
})?;
debug!("handles remaining: {}", n);
let results = &mut self.results;
let pending = &self.pending;
self.set.multi.messages(|msg| {
let token = msg.token().expect("failed to read token");
if let Some(result) = msg.result() {
let handle = &pending[&token].1;
if let Some(result) = msg.result_for(&handle) {
results.push((token, result.map_err(|e| e.into())));
} else {
debug!("message without a result (?)");