-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Improvement idea: bubble errors from clientMiddleware #359
Comments
Very interesting. I like how it's a feature that you needn't know about unless you want to use it. PR that baby on in here. |
I've been messing with error handling.. I have another idea that wraps dispatcher to catch errors by default. I'll have code examples here soon. |
Ok, here's the updated idea: By default, To make things easier, there are two utilities added in |
@erikras Why do you need this catch? Isn't it a duplication of the same thing? Maybe I've missed smth, but as I can see it could be enough to handle just a promise rejection without
|
See comparison: (Edit: link was here, but whoops, I force-pushed over my master branch)
First, I changed
next
todispatch
within the promise callbacks. Doesn't seem necessary to callnext
in these contexts. Am I wrong?Next, by default we will just swallow errors and return them as success by default. But, if you pass in
bubbleErrors: true
, instead the promise will throw, and you can catch as in my example.This is useful for cases where you'd want to grab an error and display in a special way, such as calling
dispatch
to send it to a global error component.Thoughts?
The text was updated successfully, but these errors were encountered: