File tree Expand file tree Collapse file tree 2 files changed +9
-11
lines changed
mithril-aggregator/src/file_uploaders
mithril-client/src/file_downloader Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -53,11 +53,11 @@ pub trait FileUploader: Sync + Send {
53
53
nb_attempts += 1 ;
54
54
match self . upload_without_retry ( filepath) . await {
55
55
Ok ( result) => return Ok ( result) ,
56
- Err ( _ ) if nb_attempts >= retry_policy. attempts => {
57
- return Err ( anyhow:: anyhow!(
58
- "Upload failed after {} attempts" ,
59
- nb_attempts
60
- ) ) ;
56
+ Err ( e ) if nb_attempts >= retry_policy. attempts => {
57
+ return Err ( anyhow:: anyhow!( e ) . context ( format ! (
58
+ "Upload failed after {nb_attempts } attempts. Uploaded file path: {} " ,
59
+ filepath . display ( )
60
+ ) ) ) ;
61
61
}
62
62
_ => tokio:: time:: sleep ( retry_policy. delay_between_attempts ) . await ,
63
63
}
Original file line number Diff line number Diff line change @@ -81,12 +81,10 @@ impl FileDownloader for RetryDownloader {
81
81
. await
82
82
{
83
83
Ok ( result) => return Ok ( result) ,
84
- Err ( _) if nb_attempts >= retry_policy. attempts => {
85
- return Err ( anyhow:: anyhow!(
86
- "Download of location {:?} failed after {} attempts" ,
87
- location,
88
- nb_attempts
89
- ) ) ;
84
+ Err ( e) if nb_attempts >= retry_policy. attempts => {
85
+ return Err ( anyhow:: anyhow!( e) . context ( format ! (
86
+ "Download of location {location:?} failed after {nb_attempts} attempts" ,
87
+ ) ) ) ;
90
88
}
91
89
_ => tokio:: time:: sleep ( retry_policy. delay_between_attempts ) . await ,
92
90
}
You can’t perform that action at this time.
0 commit comments