-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Ensure errors thrown from submit handler are not silenced #3744
Conversation
Fixes redux-form#3303 In the very likely case that an error is encountered during a submit callback we need to be able to reliably detect any failures. This restores the correct behavior stated in the [documentation](https://redux-form.com/7.2.0/docs/api/reduxform.md/#-code-submit-promise-code-): > Submits the form. [You'd never have guessed that, right?] Returns a promise that will be resolved when the form is submitted successfully, or rejected if the submission fails. This will revert the change made in redux-form#3227, but throwing the error is a _far better_ compromise that benefits a _much larger set_ of redux-form users. It's possible to silence errors in your own code, but not possible to recover discarded errors from inside an isolated context in a lib.
Codecov Report
@@ Coverage Diff @@
## master #3744 +/- ##
======================================
Coverage 100% 100%
======================================
Files 70 70
Lines 1578 1578
======================================
Hits 1578 1578
Continue to review full report at Codecov.
|
Published in |
While I 100% agree with this pull, errors should not be swallowed, I'm wondering how we are supposed to consume the error thrown here? At the moment the error I throw in asyncValidate is not handled anywhere and ends up in the console. I'd love to catch the error, but I can't find anywhere to catch what this change throws. Any tips? |
@dave-irvine I haven't used |
Hi @10xjs, unfortunately no matter what you do in |
I wonder if we need a new |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Fixes #3303
In the very likely case that an error is encountered during a submit callback we need to be able to reliably detect any failures.
This restores the correct behavior stated in the documentation:
This will revert the change made in #3227, but throwing the error is a far better compromise that benefits a much larger set of redux-form users. It's possible to silence errors in your own code, but not possible to recover discarded errors from inside an isolated context in a lib.