Don't panic when unable to hash image.

This commit is contained in:
Syfaro 2019-04-11 23:25:01 -05:00
parent 92e44a05a0
commit c4d788cc2e
3 changed files with 11 additions and 5 deletions

6
Cargo.lock generated
View File

@ -389,7 +389,7 @@ name = "fa-watcher"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"furaffinity-rs 0.1.0 (git+ssh://git@huefox.com/syfaro/furaffinity-rs.git?rev=96b131136a8859a75573552f34c1a6c763f65df7)", "furaffinity-rs 0.1.0 (git+ssh://git@huefox.com/syfaro/furaffinity-rs.git?rev=0d1deeeb44be8217325de45e5122f13e03c4e7ef)",
"postgres 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", "postgres 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)",
"r2d2 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", "r2d2 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)",
"r2d2_postgres 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "r2d2_postgres 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -476,7 +476,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "furaffinity-rs" name = "furaffinity-rs"
version = "0.1.0" version = "0.1.0"
source = "git+ssh://git@huefox.com/syfaro/furaffinity-rs.git?rev=96b131136a8859a75573552f34c1a6c763f65df7#96b131136a8859a75573552f34c1a6c763f65df7" source = "git+ssh://git@huefox.com/syfaro/furaffinity-rs.git?rev=0d1deeeb44be8217325de45e5122f13e03c4e7ef#0d1deeeb44be8217325de45e5122f13e03c4e7ef"
dependencies = [ dependencies = [
"chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2095,7 +2095,7 @@ dependencies = [
"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
"checksum furaffinity-rs 0.1.0 (git+ssh://git@huefox.com/syfaro/furaffinity-rs.git?rev=96b131136a8859a75573552f34c1a6c763f65df7)" = "<none>" "checksum furaffinity-rs 0.1.0 (git+ssh://git@huefox.com/syfaro/furaffinity-rs.git?rev=0d1deeeb44be8217325de45e5122f13e03c4e7ef)" = "<none>"
"checksum futf 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7c9c1ce3fa9336301af935ab852c437817d14cd33690446569392e65170aac3b" "checksum futf 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7c9c1ce3fa9336301af935ab852c437817d14cd33690446569392e65170aac3b"
"checksum futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "62941eff9507c8177d448bd83a44d9b9760856e184081d8cd79ba9f03dd24981" "checksum futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "62941eff9507c8177d448bd83a44d9b9760856e184081d8cd79ba9f03dd24981"
"checksum futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" "checksum futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4"

View File

@ -13,4 +13,4 @@ chrono = "^0.4"
[dependencies.furaffinity-rs] [dependencies.furaffinity-rs]
git = "ssh://git@huefox.com/syfaro/furaffinity-rs.git" git = "ssh://git@huefox.com/syfaro/furaffinity-rs.git"
rev = "96b131136a8859a75573552f34c1a6c763f65df7" rev = "0d1deeeb44be8217325de45e5122f13e03c4e7ef"

View File

@ -142,7 +142,13 @@ fn main() {
} }
}; };
let sub = fa.calc_image_hash(sub).expect("unable to hash image"); let sub = match fa.calc_image_hash(sub.clone()) {
Ok(sub) => sub,
Err(e) => {
println!("unable to hash image: {:?}", e);
sub
},
};
insert_submission(&client, &sub).unwrap(); insert_submission(&client, &sub).unwrap();