Catch your bugs before your customers do

You've probably been there. Deploying your app to production, you might even have backend error logs setup, but whenever there is a javascript error, you wait for your customers to report it. And you should not.

At Mews, we rely heavily on monitoring and automated error reporting. We use LogEntries to keep track of everything that happens on the backend and frontend of our products and we have NewRelic to have insights into the app performance.

And, when some unexpected errors happen, there is Sentry. We don't want to see ourselves in a situation such as one of the airways companies.

It's even worse when you fail to respond to a reported issue appropriately, but that's different story. At Mews, we try hard to take really great care of our clients.

So, how difficult it is to set this up? Not much.

You sign up for a free account at https://sentry.io/welcome/ to get the your dsn.

Add JS script to your website.

<script src="https://browser.sentry-cdn.com/4.6.4/bundle.min.js" crossorigin="anonymous"></script>

Initialize the Sentry with the dsn obtained at sentry.io.

Sentry.init({ dsn: 'https://<key>@sentry.io/<project>' });

And, depending how your Javacript code is organised, either wrap the main JS call into try, catch

try {
  runApp();
} catch (err) {
  Sentry.captureException(err);
}

or just rely on global handlers that Sentry set up for you to capture uncaught exceptions and unhandled rejections.

It's important not to rely on your QA team or customers to find actual errors in your system especially if you want to scale up your solution. Automate your processes as much as you can.