riverpod
riverpod copied to clipboard
Make sure uncaught exceptions within providers are properly reported to the zone
Currently if an exception is thrown within a Provider/FutureProvider/... then the exception is never sent to the zone.
This is "alright" for a Provider
, as they rethrow the error on read. But a FutureProvider
does not and instead return the value as AsyncError, which can be ignored
Let's make sure that if a provider throws, the Zone knows it.
looks like issues are related https://github.com/rrousselGit/riverpod/issues/1377
uncaught exception occurs and this causes the item FutureProvider.family
state to get stuck in AsyncLoading
state
I'm having an issue with my program early exiting, and from this thread I suspect it may be due to this uncaught exception error. Can you advise a recommended work around for this particular issue, so that I can see if its the cause of what I'm experiencing?
FWIW, I believe this is actually the second project in which I've had this issue, but the root cause is almost impossible to debug and track down that its easy to spend hours scratching your head and never realize its from riverpod. In other words, its likely that more devs experience this issue than have reported it, and the lack of visibility into error reporting makes this a high impact issue IMO.
Considering #1580, It seems that uncaught exception in build() is ignored very silently for now. At least one of the issues should be solved.