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

Is there a way to catch errors? #8

Open
scott-the-brewer opened this issue Apr 3, 2024 · 2 comments
Open

Is there a way to catch errors? #8

scott-the-brewer opened this issue Apr 3, 2024 · 2 comments

Comments

@scott-the-brewer
Copy link

At the moment when there is an error, for example a common case will be Camera permission not given. An error dialog is shown by default to the user.

It would be good if there was a callback for catching this error, so developers can implement a better UX flow for users when they encounter specific errors.

At the moment, there is just the global setting of showErrorDialog: true.

image

@ivancuric
Copy link
Contributor

ivancuric commented Apr 5, 2024

Hey, an onError callback will be added in the next version as it seems to be an oft requested feature.

In the meantime, you can subscribe to the errorState property inside the zustand store

https://github.com/BlinkID/capture-browser#state-management-and-subscriptions

For example:

CaptureSdk.subscribe(state => state.errorState, (error) => {
  // do something with the error
})

When implemented, `onError` will just be a thin wrapper over this subscription.

@Tyg0th
Copy link

Tyg0th commented May 10, 2024

Hi, we have the same question, I think this will be very helpfull!

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

3 participants