Ignore JSON deserialization errors.

This commit is contained in:
Syfaro 2020-10-09 14:58:28 -04:00
parent 54d18020a9
commit c9a6706d5c

View File

@ -75,7 +75,7 @@ async fn load_submission(
) -> anyhow::Result<Option<(WeasylSubmission, serde_json::Value)>> { ) -> anyhow::Result<Option<(WeasylSubmission, serde_json::Value)>> {
println!("Loading submission {}", id); println!("Loading submission {}", id);
let body: serde_json::Value = client let body: Result<serde_json::Value, _> = client
.get(&format!( .get(&format!(
"https://www.weasyl.com/api/submissions/{}/view", "https://www.weasyl.com/api/submissions/{}/view",
id id
@ -84,7 +84,12 @@ async fn load_submission(
.send() .send()
.await? .await?
.json() .json()
.await?; .await;
let body = match body {
Err(_err) => return Ok(None),
Ok(body) => body,
};
let data: WeasylResponse<WeasylSubmission> = serde_json::from_value(body.clone())?; let data: WeasylResponse<WeasylSubmission> = serde_json::from_value(body.clone())?;