Handle Error Conditions in a Reducer using redux-actions

Share this video with your friends

Send Tweet

In this lesson, we’ll see how we can handle success and error conditions independently using next and throw properties in a reducerMap with handleActions. We’ll add calls to catch for our fetch calls and display error messages when we encounter an error.

Chester Rivas
Chester Rivas
~ 6 years ago

Are you saying that redux-actions knows automatically to use the next and throw keys depending on if the payload is a success payload or an error payload? Or did I miss something?

Andy Van Slaars
Andy Van Slaars(instructor)
~ 6 years ago

Are you saying that redux-actions knows automatically to use the next and throw keys depending on if the payload is a success payload or an error payload? Or did I miss something?

Yup. If your payload is an Error object, it will use the throw property, anything else will be handled by next

Manjunath
Manjunath
~ 6 years ago

This is so frickin cool. So this only works if you use the actionCreator right ?