Reporting handled errors

This documentation is for the original BugSnag React Native SDK. We recommend upgrading to the React Native package that is now part of the Universal JavaScript SDK using our Upgrade guide. Documentation for the latest release can be found here.

In order to quickly understand and fix some errors, it is often helpful to send additional diagnostic data which is specific to that error.

The Client.notify funtion accept a callback with an error report object as an additional argument to inspect and modify the error report.

The Report object

context

Set the context of the error report. This is normally the location of the error and should be populated automatically. Context is displayed in the dashboard prominently.

bugsnag.notify(error, function(report) {
  report.context = 'Pause menu';
});

errorClass

The type of the error which generated the report. This should be populated automatically with the class name of the error.

bugsnag.notify(error, function(report) {
  report.errorClass = 'Invalid account error';
});

errorMessage

The message or description of the error which generated the report.

bugsnag.notify(error, function(report) {
  report.errorMessage = 'Too many conflicting requests sent';
});

groupingHash

Sets the grouping hash of the error report. All errors with the same grouping hash are grouped together. This is an advanced usage of the library and mis-using it will cause your errors not to group properly in your dashboard.

bugsnag.notify(error, function(report) {
  report.groupingHash = 'Invalid account errors:index.js';
});

metadata

To attach additional diagnostic data to a report, use the metadata property, which is mapped to metadata tabs on a report in the BugSnag dashboard. Each top-level key adds an additional tab:

bugsnag.notify(error, function(report) {
  report.metadata = {
    'account': {
      'company': 'Acme Co',
      'id': 4324
    }
  };
});

severity

A rating of how critical an error report is, from the values ‘error’, ‘warning’, and ‘info’, in order of decreasing severity. By default, handled errors have a ‘warning’ severity and unhandled errors have ‘error’ severity.

bugsnag.notify(error, function(report) {
  report.severity = 'warning';
});