I have a saga:
function* sagaOne() {
try {
yield all(users.map((user) => call(sagaTwo, user));
console.log('test'); // being called even if the promise above rejected!
} catch (error) {
// stuff
}
}
saga above calls saga below in yield all
effect.
function* sagaTwo() {
try {
yield call(api); // some api call that fails
} catch (error) {
// stuff
}
}
Why does this happen? Even if api throws 422 error and sagaTwo
throws an error, the sagaOne
continues the flow and does not catch the error. Why?!
Edit: Im using axios for http requests
You're trying to catch the same error twice, either remove the catch from sagaTwo or throw the error from its catch so that sagaOne can catch it again.