Skip to content

Commit

Permalink
error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
neurosnap committed Nov 16, 2023
1 parent 5c405f2 commit 796c0ce
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions store/persist.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,17 @@ it(tests, "can persist to storage adapters", async () => {

await store.run(function* (): Operation<void> {
yield* schema.update(db.loaders.start({ id: "PERSIST_REHYDRATE" }));
yield* persistor.rehydrate();
yield* schema.update(db.loaders.success({ id: "PERSIST_REHYDRATE" }));
const result = yield* persistor.rehydrate();
if (result.ok) {
yield* schema.update(db.loaders.success({ id: "PERSIST_REHYDRATE" }));
} else {
yield* schema.update(
db.loaders.error({
id: "PERSIST_REHYDRATE",
message: result.error.message,
}),
);
}

const group = yield* parallel([
function* (): Operation<void> {
Expand Down

0 comments on commit 796c0ce

Please sign in to comment.