mirror of
https://github.com/MedzikUser/imgurs
synced 2024-08-15 00:03:19 +00:00
if upload image error send notify
This commit is contained in:
parent
24d7be84fa
commit
e129ab0d65
3 changed files with 10 additions and 3 deletions
|
@ -14,6 +14,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||
- added manpage
|
||||
- added completion for elvish
|
||||
|
||||
### Library
|
||||
- added Clone derive
|
||||
|
||||
## [0.3.0] - 2022-01-28
|
||||
### CLI
|
||||
- SimpleLogger init error handling
|
||||
|
|
|
@ -58,5 +58,3 @@ features = ["json", "rustls-tls"]
|
|||
[dependencies.tokio]
|
||||
version = "1.17.0"
|
||||
features = ["macros", "rt-multi-thread"]
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
|
|
@ -29,7 +29,13 @@ pub async fn upload_image(client: ImgurClient, path: &str) {
|
|||
panic!("{path} is not a url")
|
||||
}
|
||||
|
||||
let i = upload_img(client, &image).await.expect("send api request");
|
||||
let i = upload_img(client, &image).await.unwrap_or_else(|err| {
|
||||
notify!(Notification::new()
|
||||
.summary("Error!")
|
||||
.body(&format!("Error: {}", &err.to_string()))
|
||||
.appname("Imgurs")); // I don't think you can set it to error
|
||||
panic!("{}", err)
|
||||
});
|
||||
print_image_info(i.clone());
|
||||
|
||||
let body = format!("Uploaded {}", i.data.link);
|
||||
|
|
Loading…
Reference in a new issue