We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7fbef83 commit 6237e57Copy full SHA for 6237e57
1 file changed
libsql/src/sync.rs
@@ -68,6 +68,8 @@ pub enum SyncError {
68
InvalidLocalGeneration(u32, u32),
69
#[error("invalid local state: {0}")]
70
InvalidLocalState(String),
71
+ #[error("invalid remote state: {0}")]
72
+ InvalidRemoteState(String),
73
#[error("server returned invalid length of frames: {0}")]
74
InvalidPullFrameBytes(usize),
75
}
@@ -616,8 +618,10 @@ impl SyncContext {
616
618
.await
617
619
.map_err(SyncError::HttpBody)?;
620
- let info = serde_json::from_slice(&body).map_err(SyncError::JsonDecode)?;
-
621
+ let info: InfoResult = serde_json::from_slice(&body).map_err(SyncError::JsonDecode)?;
622
+ if info.current_generation == 0 {
623
+ return Err(SyncError::InvalidRemoteState("generation is 0".to_string()).into());
624
+ }
625
Ok(info)
626
627
0 commit comments