aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTeddy Wing2021-06-13 13:28:06 +0200
committerTeddy Wing2021-06-13 13:30:10 +0200
commit7ec559e6b717560522976c6c5a410ccff3785b04 (patch)
treea32c6c8ae5af8ba9a0bb558c40c17f5818e11c27 /src
parent730a82f73beb8054543e424d47b431dd2b94d305 (diff)
downloadreflectub-7ec559e6b717560522976c6c5a410ccff3785b04.tar.bz2
run(): Prefix repository errors with the name of the repository
So you know what the error referred to.
Diffstat (limited to 'src')
-rw-r--r--src/main.rs29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/main.rs b/src/main.rs
index ee639dd..8d97239 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -154,19 +154,26 @@ fn run() -> Result<(), MultiError> {
.map(|repo| {
dbg!("Thread", std::thread::current().id());
- process_repo(
- &repo,
- &db,
- &mirror_root,
- base_cgitrc.clone(), // TODO: Can we avoid cloning
- max_repo_size_bytes,
+ (
+ repo.name.clone(),
+ process_repo(
+ &repo,
+ &db,
+ &mirror_root,
+ base_cgitrc.clone(), // TODO: Can we avoid cloning
+ max_repo_size_bytes,
+ ),
)
})
- .filter(|r| r.is_err())
-
- // `e` should always be an error.
- .map(|e| e.err().unwrap())
- // TODO: Prefix error with repo name
+ .filter(|(_, r)| r.is_err())
+
+ // `error` should always be an error.
+ .map(|(name, error)| {
+ error
+ .err()
+ .unwrap()
+ .context(name)
+ })
.collect();
if errors.len() > 0 {