According to your https://enrose.github.io/React/redux-saga-error-handling.html post there are 2 alternative options.
As I understand, they have different purpose:
“ try-catch wrapper” handlers errors within saga functions(generators),
“ Global error handler” (Option 1) in middleware handles errors happened in reducer, not sagas.
According to https://redux.js.org/advanced/middleware Redux middleware provides a third-party extension point between dispatching an action, and the moment it reaches the reducer.
So it couldn’t catch the errors in sagas.
Please correct me, if my understanding wrong.
sagaMiddleware.run(rootSaga).done.catch ( option 2) doesn’t allow to compensate/handle error.
From https://redux-saga.js.org/docs/basics/ErrorHandling.html:
Errors in forked tasks bubble up to their parents until it is caught or reaches the root saga. If an error propagates to the root saga the whole saga tree is already terminated.
So you can only log the error and terminate application, as sagas are corrupted.
According to your https://enrose.github.io/React/redux-saga-error-handling.html post there are 2 alternative options.
As I understand, they have different purpose:
“ try-catch wrapper” handlers errors within saga functions(generators),
“ Global error handler” (Option 1) in middleware handles errors happened in reducer, not sagas.
According to https://redux.js.org/advanced/middleware Redux middleware provides a third-party extension point between dispatching an action, and the moment it reaches the reducer.
So it couldn’t catch the errors in sagas.
Please correct me, if my understanding wrong.
sagaMiddleware.run(rootSaga).done.catch ( option 2) doesn’t allow to compensate/handle error.
From https://redux-saga.js.org/docs/basics/ErrorHandling.html:
So you can only log the error and terminate application, as sagas are corrupted.