From eaccfeed4dfb7822335700efa130003b466081b5 Mon Sep 17 00:00:00 2001 From: "Levy A." Date: Fri, 17 Jan 2025 00:31:41 -0300 Subject: [PATCH] fix: prevent reporting http errors in `sync_offline` resolves #1919 --- libsql/src/local/database.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libsql/src/local/database.rs b/libsql/src/local/database.rs index c0f82c66df..79ccb4b90d 100644 --- a/libsql/src/local/database.rs +++ b/libsql/src/local/database.rs @@ -492,6 +492,21 @@ impl Database { } else { self.try_pull(&mut sync_ctx, &conn).await } + .or_else(|err| { + let Error::Sync(err) = err else { + return Err(err); + }; + + // Ideally, *err* wouldn't be type erased, we aren't doing dynamic typing. + let Some(SyncError::HttpDispatch(_)) = err.downcast_ref::() else { + return Err(Error::Sync(err)); + }; + + Ok(crate::database::Replicated { + frame_no: None, + frames_synced: 0, + }) + }) } #[cfg(feature = "sync")]