Capture Exceptions

Use captureException() to manually report an Error caught by your code.

try {
  doSomethingBroken();
} catch (err) {
  LogRocket.captureException(err, {
    tags: {
      // additional data to be grouped as "tags"
      subscription: 'Pro',
    },
    extra: {
      // additional arbitrary data associated with the event
      pageName: 'ProfileView',
    },
  });
}

Use tags and extra to send additional metadata with the error. The values contained in the tags and extra objects must be scalar values (e.g., booleans, numbers, or strings). Tags and extra data will appear within the error in the LogRocket dashboard.