Remove result.error and throw errors instead #646
Labels
BREAKING CHANGE
This change will require a major version bump
enhancement
New feature or request
request for comment
Discussion about changes to the library
Describe the feature you'd like:
It's been discussed a lot in other issues, but never formally proposed, to remove the
result.error
property and instead simply allow rendering errors be throw out of the render calls and cause the async utils to reject. The current functionality is, IMO, not very intuitive and has resulted in issues being raised and some weird work arounds.Suggested implementation:
Ideally, the implementation would remove the
ErrorBoundary
we use now to catch the errors, however I am concerned that errors thrown inuseEffect
will not be thrown as expected without it. Although I haven't tested this, it was required for the current implementation as previously, they were not catchable by wrappingrender
with atry/catch
.Describe alternatives you've considered:
The only alternative I've considered is leaving it as is. I'm happy to hear other's thoughts and ideas for alternative.
Teachability, Documentation, Adoption, Migration Strategy:
I think teachability will be easier than what we have now. We could update the docs to show examples using the
jest
error handling features.The migration would need to be a breaking change (I think). I think the impact on most people will be minimal as they generally don't test error cases, but those that do would need to update their tests. We should provider migration docs at the very least, but we could consider a code mod as it should be a pretty straight forward conversion in most cases.
The text was updated successfully, but these errors were encountered: