Skip to content

Commit 6196a46

Browse files
authored
Merge pull request #154 from noobLue/master
Account for failed downloads in the finish_stage of download_or_update
2 parents 0d0ea55 + db5d0e3 commit 6196a46

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

tmc-langs/src/lib.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -411,14 +411,26 @@ pub fn download_or_update_course_exercises(
411411
};
412412
}
413413

414-
progress_reporter::finish_stage::<ClientUpdateData>(
414+
let finish_message = if failed.is_empty() {
415+
if successful.len() == 0 && exercises_len == 0 {
416+
"Exercises are already up-to-date!".to_string()
417+
} else {
418+
format!(
419+
"Successfully downloaded {} out of {} exercises.",
420+
successful.len(),
421+
exercises_len
422+
)
423+
}
424+
} else {
415425
format!(
416-
"Successfully downloaded {} out of {} exercises.",
426+
"Downloaded {} out of {} exercises ({} failed)",
417427
successful.len(),
418-
exercises_len
419-
),
420-
None,
421-
);
428+
exercises_len,
429+
failed.len(),
430+
)
431+
};
432+
433+
progress_reporter::finish_stage::<ClientUpdateData>(finish_message, None);
422434

423435
let downloaded = successful
424436
.into_iter()

0 commit comments

Comments
 (0)