feat(tui): surface the failure reason on failed downloads
Carry a human-readable reason on DownloadStatus::Failed so it flows through the existing status channel to the TUI. The download Info pane now shows an Error line for a failed download (connect failure, peer disconnect, truncated transfer, peer-reported upload failure, or the underlying transfer error). Failures without a known reason render as before.
This commit is contained in:
@@ -149,7 +149,9 @@ pub fn collect_failed_tokens(
|
||||
d.username == username && filename.is_none_or(|f| d.filename == *f)
|
||||
})
|
||||
.map(|d| {
|
||||
let _ = d.sender.send(DownloadStatus::Failed);
|
||||
let _ = d.sender.send(DownloadStatus::Failed(Some(
|
||||
"Peer reported the upload failed".to_string(),
|
||||
)));
|
||||
d.token
|
||||
})
|
||||
.collect()
|
||||
@@ -301,7 +303,7 @@ mod tests {
|
||||
assert_eq!(tokens, vec![1]);
|
||||
assert!(matches!(
|
||||
rx_match.try_recv().unwrap(),
|
||||
DownloadStatus::Failed
|
||||
DownloadStatus::Failed(_)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user