How to add a global error handler for all reduction-observable epics?

I am working on a React Native application using a shorthand value. I have 10+ epics, all end on .catch(err => console.error(err))to display the React Native "Red box" (see https://facebook.imtqy.com/react-native/docs/debugging.html#errors ) in case of errors inside the epic.

How can I determine the global error handler used by all epics (they are later combined by function combineEpics)?

+4
source share
1 answer

redux-observable RxJS , . Epics , Epic, function (action$, store). , Epic , Epics, .

, rootEpic combineEpics(). Epics - , , (action$, store)!

:

export const rootEpic = (action$, store) =>
  combineEpics(epic1, epic2, epic3)(action$, store) // <-- call epic w/ args
    .do({ error: err => console.error(err) });

, .catch() , .catch() Observable , . ( ), .do() - , (, ), .

Composing Epics , , , .

.catch() RFC .

+10

Source: https://habr.com/ru/post/1654617/


All Articles