Error Reporting

Error reporting in JavaScript and native code

Error reporting#

Monitoring the production app is as critical as releasing one. There are a lot of tools in the market that help to do that. Custom logging by developers to monitor the app has become an outdated practice, and integrating a monitoring tool is a must.

React Native is mostly JavaScript. As we noticed earlier that a lot of the tools used for debugging come from the JavaScript world, so it is with error reporting too. Most of the popular web solutions already provide some kind of integration to React Native.

Based on my experience, we will look at integrating and using Sentry, though feel free to try others like Bugsnag, etc - they are equally good.

Sentry#

Sentry's React Native SDK enables automatic reporting of errors and exceptions, and identifies performance issues in your application. The SDK includes performance monitoring by default.

In the JavaScript world, Sentry is a popular tool used for error and performance monitoring. It is used quite widely in web applications, and with its JavaScript expertise, it makes for a good choice in React Native too.

It has a free version that developers can use (there is a limit to the number of events per month), which is a good place to start.

I am not affiliated with, or make any money, if students of this course use Sentry. After vetting a few options, it has been my preferred choice and hence the recommendation.

Installation#

or

Next, we need to run the Sentry wizard:

This will run a few steps and open the browser for some auth. Follow the steps to complete the installation.

Setup#

Sentry needs to be initialized as early as possible in the app lifecycle. Configure this at the entry point of the app - ./index.js:

Start a new discussion. All notification go to the author.