Reporting Crashes for React Native

Covered here are APIs relevant to crash reporting for your React Native app.

🚧

Privacy Policy

It is highly recommended to mention in your privacy policy that you may be collecting logging data in order to assist with troubleshooting crashes.

With Instabug Crash Reporting there are two ways to have your application report a crash, either automatically or manually. After the crash is sent to your dashboard, you can sort and filter for specific crashes easily.

Automatic Crash Reporting

If you enable Crash Reporting, crashes will automatically be reported to and viewable from the crashes page of your Instabug dashboard.

You'll also see the trends covering the previous 7 days, including:

  • Crash-free sessions: the percentage of sessions that ran and concluded without any fatal errors.
  • Crash-free users: the percentage of users that haven't encountered any fatal errors.
  • Crashing sessions: the number of sessions that ran and concluded with a fatal error.
  • Affected users: the number of unique users who had one or more sessions that ended with a fatal error.
  • Total number of occurrences: by hovering on it, you’ll get a breakdown of the number of fatal sessions, the number of OOM sessions, the number of ANR sessions, and the number of non-fatal sessions.

If there is a sharp decline in the crash-free sessions rate, an email will be sent to notify you.

This is the crashes page of the Instabug dashboard

This is the crashes page of the Instabug dashboard.

🚧

Warning

Crash reporting will not function correctly if the device is connected to Xcode. When it is, Xcode catches all exceptions and they will not be sent to your dashboard.

Manual Crash Reporting

You can offer your users Instabug Bug Reporting to report bugs. However, you can use the following method and API to manually report any error or exception that you handle in your code and assign it a severity level.

Report Exception

To report exceptions manually, use the following method.

try {
      throw new SyntaxError();
    } catch (err) {
      if (err instanceof Error) {
        CrashReporting.reportError(err);
      }
    }

🚧

Release Mode

Crashes will only be reported in release mode and not in debug mode.

📘

Min Required SDK version

Customizing crash level and custom grouping is supported starting SDK v13.1.1.

Add Level to Exception

You can set different severity levels for manually reported exceptions using the following API:

try {
      throw new SyntaxError();
    } catch (err) {
      if (err instanceof Error) {
        CrashReporting.reportError(err,{
          level: NonFatalErrorLevel.critical,
        });
      }
    }

Here are the different severity levels available. In case no level is indicated, the default level would be error.

NonFatalErrorLevel.info;
NonFatalErrorLevel.error;
NonFatalErrorLevel.warning;
NonFatalErrorLevel.critical;

Grouping

When an already existing crash occurs once more for any user, that crash is reported as an occurrence in the original entry. However, in order to calculate whether a crash already exists and needs to be grouped, Instabug generates a fingerprint based on attributes used in the grouping logic.

The default Instabug grouping algorithm uses a mix of the exception and stack trace information. In some cases, you might want to change how the issues are grouped together using fingerprints.

Custom Figerprinting

🚧

Overriding the default grouping

Please note that using custom fingerprinting will override Instabug's default grouping by sending a fingerprint string.

In the event that you'd like to report the exception manually with a custom grouping fingerprint in mind, you can use the below APIs to do just that.

try {
      throw new SyntaxError();
    } catch (err) {
      if (err instanceof Error) {
          CrashReporting.reportError(err, {
            fingerprint: 'grouping fingerprint',
            userAttributes: userAttributesObject,
          });
      }
    }

Crashes List

This section contains a list of all the crashes that have been reported by your application. The title of each crash is usually the most significant line in the stack trace.

2160

An example of the list of crashes in the crashes page of the Instabug dashboard.

Next to each crash in the list, you can find the following details, all of which can be used to sort the crashes:

  • Occurrences: The number of times this crash has occurred and a bar graph representing its occurrences over the past seven days.
  • Users: The number of users affected by this crash.
  • Min ver.: The oldest app version that was affected by this crash.
  • Max ver.: The latest app version that was affected by this crash.
  • Last seen: The last time an occurrence of this crash was reported.

You can then filter for crashes that match any of the following criteria:

  • App version
  • Date
  • Device
  • OS
  • User attributes
  • Type
  • Status
  • Assignee
  • Team
  • Tags
  • Current view
  • Experiments

What’s Next

Learn more about the content contained in crash reports as well as how to symbolicate them. You can also use event handlers to collect additional information.