Right pattern for reporting error to user
See original GitHub issueWith Redux Saga, what’s the recommended pattern to report error while executing an operation to user? With redux-thunk
we can return a promise while dispatching an operation and allow user to essentially observe that promise. Since all the actions are plain objects in saga world, this isn’t possible. And it’s not always convenient to report error via state change (think react native alerts)
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
How to Report Errors in Forms: 10 Design Guidelines
How to Report Errors in Forms: 10 Design Guidelines · 1. Aim for Inline Validation Whenever Possible · 2. Indicate Successful Entry for...
Read more >Patterns for Generation, Handling and Management of Errors
This paper sets out a collection (or possibly a language) of patterns that relate to the use of error generating, handling and logging...
Read more >Error Messages: Examples, Best Practices & Common Mistakes
Useful error messages can keep users on your site and increase conversions. See examples and learn the best practices.
Read more >Errors | Content patterns | Intuit Content Design System
Errors and error messages continue to be a content design and strategy challenge. Here's a plan to respond clearly and fairly when the...
Read more >How to design and convey error messages properly - Bootcamp
1. Providing Clarity · 2. Concise, but precise · 3. Don't blame users · 4. Give users a solution · 5. Proper Placement...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In
redux-thunk
you can doAnd in the calling function
Strictly speaking this isn’t going through the store, but sometimes it’s really convenient to be able to do stuff like this when interacting with other APIs that are imperative rather than declarative.
I think that there is no difference between redux-saga and redux-thunk on the ability for reporting the progress to user. Because of Redux is single state, we need to put the operation progress to the store. And the state is changed only by Actions. So you can dispatch Actions based on the progress of operations.
Note:
callAPI(...)
returns Promise objectredux-thunk (action creator)
redux-saga (without try-catch)
redux-saga (with try-catch)