captbaritone / raven-for-redux

A Raven middleware for Redux
295 stars 25 forks source link

not working with redux-saga middleware #46

Closed XiaocongDong closed 6 years ago

XiaocongDong commented 6 years ago

Hi

I am using this middleware along with redux-saga middleware, it seems like the action thrown from the reducer cannot be caught.

FYI: I use redux-actions to create my actions and reducers, etc. error stacks:

uncaught at starConversationRequestedSaga Error: star error occur in state!!
    at eval (webpack-internal:///./src/reducers/conversation/star.js:73:9)
    at eval (webpack-internal:///./node_modules/redux-actions/es/handleAction.js:49:64)
    at eval (webpack-internal:///./node_modules/reduce-reducers/lib/index.js:13:14)
    at Array.reduce (<anonymous>)
    at eval (webpack-internal:///./node_modules/reduce-reducers/lib/index.js:12:21)
    at eval (webpack-internal:///./node_modules/redux-actions/es/handleActions.js:33:12)
    at eval (webpack-internal:///./src/reducers/reset.js:32:14)
    at combination (webpack-internal:///./node_modules/redux/es/combineReducers.js:124:29)
    at eval (webpack-internal:///./node_modules/redux-persist/es/persistReducer.js:110:33)
    at computeNextEntry (<anonymous>:2:27469)
    at recomputeStates (<anonymous>:2:27769)
    at <anonymous>:2:31382
    at Object.dispatch (webpack-internal:///./node_modules/redux/es/createStore.js:170:22)
    at dispatch (<anonymous>:2:31875)
    at eval (webpack-internal:///./node_modules/raven-for-redux/built/index.js:48:16)
    at eval (webpack-internal:///./node_modules/redux-saga/es/internal/middleware.js:70:22)
    at dispatch (webpack-internal:///./node_modules/redux/es/applyMiddleware.js:37:18)
    at eval (webpack-internal:///./node_modules/redux-saga/es/internal/utils.js:282:12)
    at eval (webpack-internal:///./node_modules/redux-saga/es/internal/proc.js:498:52)
    at exec (webpack-internal:///./node_modules/redux-saga/es/internal/scheduler.js:22:5)
    at flush (webpack-internal:///./node_modules/redux-saga/es/internal/scheduler.js:63:5)
    at asap (webpack-internal:///./node_modules/redux-saga/es/internal/scheduler.js:36:5)
    at Array.eval (webpack-internal:///./node_modules/redux-saga/es/internal/channel.js:196:71)
    at Object.emit (webpack-internal:///./node_modules/redux-saga/es/internal/channel.js:37:13)
    at Object.eval [as dispatch] (webpack-internal:///./node_modules/redux-saga/es/internal/middleware.js:71:21)
    at dispatch (<anonymous>:2:1620)
    at eval (webpack-internal:///./node_modules/redux/es/bindActionCreators.js:4:12)
    at starConversation (webpack-internal:///./src/components/Index/ConversationListLayout/ConversationTableView/ConversationCells/index.js:109:15)
    at onClick (webpack-internal:///./src/components/Index/ConversationListLayout/ConversationTableView/ConversationCells/ConversationCell/index.js:86:15)
    at HTMLUnknownElement.callCallback (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:1299:14)
    at HTMLUnknownElement.wrapped (webpack-internal:///./node_modules/raven-js/src/raven.js:351:21)
    at Object.invokeGuardedCallbackDev (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:1338:16)
    at Object.invokeGuardedCallback (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:1195:27)
    at Object.invokeGuardedCallbackAndCatchFirstError (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:1209:43)
    at executeDispatch (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:1432:21)
    at Object.executeDispatchesInOrder (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:1451:7)
    at executeDispatchesAndRelease (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:1969:24)
    at executeDispatchesAndReleaseTopLevel (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:1980:10)
    at Array.forEach (<anonymous>)
    at forEachAccumulated (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:1946:9)
    at Object.processEventQueue (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:2139:7)
    at runEventQueueInBatch (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:2151:20)
    at Object.handleTopLevel [as _handleTopLevel] (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:2161:5)
    at handleTopLevelImpl (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:1800:27)
    at batchedUpdates (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:13238:14)
    at performFiberBatchedUpdates (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:1646:10)
    at stackBatchedUpdates (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:1637:10)
    at batchedUpdates (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:1651:10)
    at Object.batchedUpdatesWithControlledComponents [as batchedUpdates] (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:1664:12)
    at dispatchEvent (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:1874:30)

Thanks

koobyak commented 6 years ago

Hello, I haven't used this library yet so I can't help you troubleshoot your issue that much, but I just came here from the Sentry React documentation and thought maybe their section on Redux Saga Middleware might be able to give you some ideas? Sorry that I can't help out anything more.

captbaritone commented 6 years ago

The capturing of exceptions is actually done by Raven-js, so I would look there first. This library just adds additional context to exceptions caught by Raven-js.

greatwitenorth commented 6 years ago

I ran into a similar issue and the following code fixed the issue:

const sagaMiddleware = createSagaMiddleware({
  onError: error => {
    Raven.captureException(error)
  }
});

Now I get the errors reported when using redux-saga.

captbaritone commented 6 years ago

Is this just a case of sagas swallowing errors by default, and you having to go out of your way to ensure Raven sees them?

greatwitenorth commented 6 years ago

Yes it appears that's the case.