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

Provide default IO/SyncIO error handler for component #1084

Open
matthughes opened this issue Jun 2, 2023 · 0 comments
Open

Provide default IO/SyncIO error handler for component #1084

matthughes opened this issue Jun 2, 2023 · 0 comments

Comments

@matthughes
Copy link
Contributor

Maybe this is already possible but I'd love to be able to have a default error handler for any IO/SyncIO/Callback effect. Something like:

    ScalaComponent
      .builder[Props]("MyComponent")
      .initialState(State.Initial)
      .renderBackend[Backend]
      .onError(s => s.backend.handleError(s.error))

This would be akin to adding.onError to every effect you submit (onClick/componentDidMethods). I have to believe there is a way to do this with the Dispatch/Effect classes but can't quite figure it out. Would be great to have a more ergonomic way though. If someone could generally point my in a direction I can try to submit a PR.

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

No branches or pull requests

1 participant