Skip to content

Commit 4c0b239

Browse files
committed
Expose git errors during authentication.
1 parent 847f1f7 commit 4c0b239

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/cargo/sources/git/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use url::Url;
1212

1313
use core::GitReference;
1414
use util::{ToUrl, internal, Config, network, Progress};
15-
use util::errors::{CargoResult, CargoResultExt, Internal};
15+
use util::errors::{CargoResult, CargoResultExt, CargoError};
1616

1717
#[derive(PartialEq, Clone, Debug)]
1818
pub struct GitRevision(git2::Oid);
@@ -546,7 +546,7 @@ fn with_authentication<T, F>(url: &str, cfg: &git2::Config, mut f: F)
546546
// In the case of an authentication failure (where we tried something) then
547547
// we try to give a more helpful error message about precisely what we
548548
// tried.
549-
let res = res.map_err(Internal::new).chain_err(|| {
549+
let res = res.map_err(CargoError::from).chain_err(|| {
550550
let mut msg = "failed to authenticate when downloading \
551551
repository".to_string();
552552
if !ssh_agent_attempts.is_empty() {

tests/testsuite/build_auth.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ Caused by:
118118
failed to authenticate when downloading repository
119119
attempted to find username/password via `credential.helper`, but [..]
120120
121-
To learn more, run the command again with --verbose.
121+
Caused by:
122+
curl error: Failed to connect to 127.0.0.1 port [..]: Connection refused
123+
; class=Net (12)
122124
",
123125
addr = addr)));
124126

0 commit comments

Comments
 (0)