captbaritone / raven-for-redux

A Raven middleware for Redux
295 stars 25 forks source link

Capture reducer errors? #45

Closed thom-nic closed 6 years ago

thom-nic commented 6 years ago

I tried redux-sentry first then moved to this project thinking it behaved the same. However it appears this project does not capture exceptions thrown from a reducer.

Noting the difference between this and redux-sentry I can see why: the catch/ captureException call.

So, why doesn't raven-for-redux do this as well?

captbaritone commented 6 years ago

Raven should capture all uncaught exceptions, including those thrown from the reducer. Our approach is to attach Redux data to all exceptions rather than just explicitly attaching it to reducer exceptions.

Are you personally seeing exceptions thrown from within your reducer which are not captured by Raven?

thom-nic commented 6 years ago

Yeah that's what was happening- nothing captured by Raven even though other uncaught errors do get reported as expected. I'll post a stack trace in a bit so we can try to track down where they are being lost.

captbaritone commented 6 years ago

One known issue is that exceptions with large payloads will be refused by Sentry and silently dropped. Is it possible that this is the problem you are seeing?

thom-nic commented 6 years ago

No I don't think that's the issue. Everything else gets reported and I filter out some of that bulk of my state.

I added a reporting middleware that I add after this one, which basically does what I'm describing and it works as I'd expect. So same payload gets sent successfully if I manually catch the error.

I suspect maybe something further up the stack (maybe part of redux) may be catching the error?

thom-nic commented 6 years ago

well I was half right. It looks like the action creator that triggered the error in my reducer also had a .catch() chained on it, which was handling the error (I'm using redux-thunk.) If I re-threw it, the error bubbled all the way up to the action call in the component and got captured by Raven as expected.

captbaritone commented 6 years ago

Ah, good to hear! Glad you got it figured out.