You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Modified the persistence helper to return a `String` as error in order
to be more expressive while keeping things simple. Also modified the
helper to load and check the `ChangeSet` after each `ChangeSet` in
`changesets` is persisted. It also checks if the `ChangeSet` loaded
after reopening the `Store` matches the final aggregate `ChangeSet`.
"Encountered an error from the persister while initializing the store.\nGot:\n{}",
51
+
err
52
+
)
53
+
})?;
54
+
55
+
let init_changeset = load(&mut store).map_err(|err| format!("Encountered an error from the persister while loading from the new store.\nGot:\n{}",err))?;
56
+
57
+
if init_changeset != C::default(){
58
+
Err("Loading from a new store should return an empty changeset.")?;
persist(&mut store, changeset).map_err(|err| format!("Persisting changeset no. {} failed. Got an error from the persister instead:\n{} ", i+1, err))?;
83
63
84
-
if init_changeset != CS::default(){
85
-
returnErr(PersistErr::ChangeSetMismatch{
86
-
expected:Box::new(CS::default()),
87
-
got:Box::new(init_changeset),
88
-
});
89
-
}
64
+
merged_changeset.merge(changeset.clone());
90
65
91
-
letmutmerged_changeset = CS::default();
66
+
letpersisted_changeset = load(&mutstore).map_err(|err| format!("Encountered an error from the persister while loading (after persisting changeset no. {}).\nGot:\n {}", i+1, err))?;
0 commit comments