mirror of https://github.com/MedzikUser/imgurs
if upload image error send notify
This commit is contained in:
parent
24d7be84fa
commit
e129ab0d65
|
@ -14,6 +14,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
- added manpage
|
- added manpage
|
||||||
- added completion for elvish
|
- added completion for elvish
|
||||||
|
|
||||||
|
### Library
|
||||||
|
- added Clone derive
|
||||||
|
|
||||||
## [0.3.0] - 2022-01-28
|
## [0.3.0] - 2022-01-28
|
||||||
### CLI
|
### CLI
|
||||||
- SimpleLogger init error handling
|
- SimpleLogger init error handling
|
||||||
|
|
|
@ -58,5 +58,3 @@ features = ["json", "rustls-tls"]
|
||||||
[dependencies.tokio]
|
[dependencies.tokio]
|
||||||
version = "1.17.0"
|
version = "1.17.0"
|
||||||
features = ["macros", "rt-multi-thread"]
|
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")
|
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());
|
print_image_info(i.clone());
|
||||||
|
|
||||||
let body = format!("Uploaded {}", i.data.link);
|
let body = format!("Uploaded {}", i.data.link);
|
||||||
|
|
Loading…
Reference in New Issue