Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible for reducers to handle errors #29

Merged
merged 8 commits into from
Dec 4, 2023

Conversation

carlsverre
Copy link
Contributor

Now, reducers can handle errors. Before errors were silently handled in the host which led to the reactor failing in a half-open state (thus all future calls into the reactor would fail). Now errors are passed back from the host into the reducer where it can either handle it or fail in a closed state (as in the reactor task is cleaned up).

Fixes #27

To upgrade to this version of SQLSync you will need to recompile your Reducers after making the following changes:

Before:

execute!(
    "INSERT INTO kv (key, value) VALUES (?, ?)
    ON CONFLICT (key) DO UPDATE SET value = VALUES(value)",
    key,
    value
)
.await;

After:

execute!(
    "INSERT INTO kv (key, value) VALUES (?, ?)
    ON CONFLICT (key) DO UPDATE SET value = VALUES(value)",
    key,
    value
)
.await?;

(It's very subtle, the only change is adding a ? after the await to forward the error to the caller.)

@carlsverre carlsverre merged commit e68e4c4 into main Dec 4, 2023
1 check passed
@carlsverre carlsverre deleted the carlsverre/issue27 branch December 4, 2023 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

reducer error handling
1 participant