How to use the rollbar/src/react-native/rollbar function in rollbar

To help you get started, we’ve selected a few rollbar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rollbar / rollbar-react-native / src / Rollbar.js View on Github external
constructor(config) {
    if (config instanceof Configuration) {
      this.config = config;
    } else {
      this.config = new Configuration(config);
    }
    this.config.setPlatform(Platform.OS);

    this.rollbar = new Rollbar(this.config.toJSON());

    if (NativeClient) {
      NativeClient.init(this.config.toJSON());
      this.captureUncaughtExceptions();
      if (this.config.captureUnhandledRejections) {
        this.captureUnhandledRejections();
      }
    } else {
      throw new Error('Rollbar: Native client not found. Did you run react-native link?');
    }
  }