From 7eba3654f89f168696b2f73c10406b743a31d7e9 Mon Sep 17 00:00:00 2001 From: Aleksei Voronov Date: Sun, 18 Aug 2024 21:56:01 +0200 Subject: [PATCH] Handle missing repo errors properly Apparently the error message has changed, and now we get missing repo errors, not missing record errors for deleted profiles. Let's handle it properly --- src/services/bluesky/client.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/services/bluesky/client.rs b/src/services/bluesky/client.rs index 021531f..0d4fc81 100644 --- a/src/services/bluesky/client.rs +++ b/src/services/bluesky/client.rs @@ -114,7 +114,7 @@ impl Bluesky { let profile_output = match result { Ok(profile_output) => profile_output, - Err(e) if is_missing_record_error(&e) => return Ok(None), + Err(e) if is_missing_repo_error(&e) => return Ok(None), Err(e) => return Err(e.into()), }; @@ -173,7 +173,7 @@ impl Bluesky { } } -fn is_missing_record_error(error: &atrium_xrpc::error::Error) -> bool +fn is_missing_repo_error(error: &atrium_xrpc::error::Error) -> bool where T: Debug, { @@ -193,7 +193,7 @@ where // re-export it so we have no way of referencing the real type status.as_u16() == StatusCode::BAD_REQUEST.as_u16() && error_code == "InvalidRequest" - && error_message.starts_with("Could not locate record") + && error_message.starts_with("Could not find repo") ) }