Skip to content

Commit 2158fe1

Browse files
committed
Add context for which workspace failed when resolving cargo vendor
1 parent bf3885e commit 2158fe1

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/cargo/ops/vendor.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,12 @@ fn sync(
144144
// attempt. If anything fails here we basically just move on to the next
145145
// crate to work with.
146146
for ws in workspaces {
147-
let (packages, resolve) =
148-
ops::resolve_ws(ws, dry_run).context("failed to load pkg lockfile")?;
147+
let (packages, resolve) = ops::resolve_ws(ws, dry_run)
148+
.with_context(|| format!("failed to load lockfile for {}", ws.root().display()))?;
149149

150150
packages
151151
.get_many(resolve.iter())
152-
.context("failed to download packages")?;
152+
.with_context(|| format!("failed to download packages for {}", ws.root().display()))?;
153153

154154
for pkg in resolve.iter() {
155155
let sid = if opts.respect_source_config {
@@ -187,12 +187,12 @@ fn sync(
187187
// Next up let's actually download all crates and start storing internal
188188
// tables about them.
189189
for ws in workspaces {
190-
let (packages, resolve) =
191-
ops::resolve_ws(ws, dry_run).context("failed to load pkg lockfile")?;
190+
let (packages, resolve) = ops::resolve_ws(ws, dry_run)
191+
.with_context(|| format!("failed to load lockfile for {}", ws.root().display()))?;
192192

193193
packages
194194
.get_many(resolve.iter())
195-
.context("failed to download packages")?;
195+
.with_context(|| format!("failed to download packages for {}", ws.root().display()))?;
196196

197197
for pkg in resolve.iter() {
198198
// No need to vendor path crates since they're already in the

tests/testsuite/vendor.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2016,7 +2016,7 @@ fn error_loading_which_lock() {
20162016
[ERROR] failed to sync
20172017
20182018
Caused by:
2019-
failed to load pkg lockfile
2019+
failed to load lockfile for [ROOT]/foo/b
20202020
20212021
Caused by:
20222022
could not execute process `does-not-exist -vV` (never executed)
@@ -2056,7 +2056,7 @@ fn error_downloading() {
20562056
[ERROR] failed to sync
20572057
20582058
Caused by:
2059-
failed to download packages
2059+
failed to download packages for [ROOT]/foo
20602060
20612061
Caused by:
20622062
failed to download from `[ROOTURL]/dl/bar/1.0.0/download`

0 commit comments

Comments
 (0)