mirror of
https://github.com/lights0123/n-link.git
synced 2025-07-07 03:10:33 +00:00
Added error handling to upload
subcommand
This commit is contained in:
parent
a08eb0b791
commit
fd6d7d87b6
|
@ -106,11 +106,19 @@ pub fn run() -> bool {
|
||||||
if dest.ends_with('/') {
|
if dest.ends_with('/') {
|
||||||
dest.remove(dest.len() - 1);
|
dest.remove(dest.len() - 1);
|
||||||
}
|
}
|
||||||
handle
|
let res = handle
|
||||||
.write_file(&format!("{}/{}", dest, name), &buf, &mut |remaining| {
|
.write_file(&format!("{}/{}", dest, name), &buf, &mut |remaining| {
|
||||||
bar.set_position((buf.len() - remaining) as u64)
|
bar.set_position((buf.len() - remaining) as u64)
|
||||||
})
|
});
|
||||||
.unwrap();
|
|
||||||
|
match res {
|
||||||
|
Ok(_) => {
|
||||||
|
println!("Upload {}: Ok", dest);
|
||||||
|
}
|
||||||
|
Err(error) => {
|
||||||
|
bar.abandon_with_message(&format!("Failed: {}", error));
|
||||||
|
}
|
||||||
|
}
|
||||||
bar.finish();
|
bar.finish();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue