From c9a6706d5ce961dfab66b9aa648b640123f11779 Mon Sep 17 00:00:00 2001 From: Syfaro Date: Fri, 9 Oct 2020 14:58:28 -0400 Subject: [PATCH] Ignore JSON deserialization errors. --- src/main.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index c82f512..a033d72 100644 --- a/src/main.rs +++ b/src/main.rs @@ -75,7 +75,7 @@ async fn load_submission( ) -> anyhow::Result> { println!("Loading submission {}", id); - let body: serde_json::Value = client + let body: Result = client .get(&format!( "https://www.weasyl.com/api/submissions/{}/view", id @@ -84,7 +84,12 @@ async fn load_submission( .send() .await? .json() - .await?; + .await; + + let body = match body { + Err(_err) => return Ok(None), + Ok(body) => body, + }; let data: WeasylResponse = serde_json::from_value(body.clone())?;