erikras / react-redux-universal-hot-example

A starter boilerplate for a universal webapp using express, react, redux, webpack, and react-transform
MIT License
12.01k stars 2.5k forks source link

App level error handling/logging best practice? #1275

Open realbugger opened 7 years ago

realbugger commented 7 years ago

Did a quick search but didn't find much discussion on this topic. I'm wondering what the best practice for app level error handling and logging. I posted the question here because this is the boilerplate my app is building on.

Regardless how careful I am, occasionally there still will be uncaught errors popping out, and sometimes they just throw the entire app off. In production environment, this is quite undesirable. In the minimum I'd like to have some sort of "catch all" error handling, which should log the error on server side so that I can see what was going on. I came across (this solution) but for some reason the errorObject is always null so it's pretty much useless. The only thing I changed was to invoke startErrorLog() in componentDidMount() as opposed in componentWillMount(), because window is undefined in componentWillMount() due to server side rendering. It would be helpful if anyone could share anything.

NourSammour commented 7 years ago

@ReadmeCritic did you find solution?

i'm trying to integrate airbrake.io

window.addEventListener('error', function(err) {
  return airbrake.notify(err);
}, false);

but always error message is Script error. no more details any help?

ReadmeCritic commented 7 years ago

you meant @realbugger

NourSammour commented 7 years ago

Yup, sorry for that