Expose git errors during authentication.
authorEric Huss <eric@huss.org>
Wed, 21 Feb 2018 03:30:00 +0000 (19:30 -0800)
committerEric Huss <eric@huss.org>
Wed, 21 Feb 2018 22:29:33 +0000 (14:29 -0800)
src/cargo/sources/git/utils.rs
tests/testsuite/build_auth.rs

index 640138525ee93f2c98a3e5cb506cd4c2a204f5d7..6fe8fad741b6eab2ccfa0ff3ceb7e667bbdc14e8 100644 (file)
@@ -12,7 +12,7 @@ use url::Url;
 
 use core::GitReference;
 use util::{ToUrl, internal, Config, network, Progress};
-use util::errors::{CargoResult, CargoResultExt, Internal};
+use util::errors::{CargoResult, CargoResultExt, CargoError};
 
 #[derive(PartialEq, Clone, Debug)]
 pub struct GitRevision(git2::Oid);
@@ -546,7 +546,7 @@ fn with_authentication<T, F>(url: &str, cfg: &git2::Config, mut f: F)
     // In the case of an authentication failure (where we tried something) then
     // we try to give a more helpful error message about precisely what we
     // tried.
-    let res = res.map_err(Internal::new).chain_err(|| {
+    let res = res.map_err(CargoError::from).chain_err(|| {
         let mut msg = "failed to authenticate when downloading \
                        repository".to_string();
         if !ssh_agent_attempts.is_empty() {
index 53ec0d4f1d0a3b3c41afafa4db9725d23d0becc5..66b978eb4cdb8438158f1f079810a26b4b0d552c 100644 (file)
@@ -118,7 +118,9 @@ Caused by:
   failed to authenticate when downloading repository
 attempted to find username/password via `credential.helper`, but [..]
 
-To learn more, run the command again with --verbose.
+Caused by:
+  curl error: Failed to connect to 127.0.0.1 port [..]: Connection refused
+; class=Net (12)
 ",
         addr = addr)));