How to use the rollbar.handleUncaughtExceptionsAndRejections 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 maxbeatty / passplum / lib / monitor.js View on Github external
Joi.validate(options, schema, (err) => {

        if (err) {
            return next(err);
        }

        Rollbar.init(options.rollbar.accessToken, {
            environment: options.env
        });

        Rollbar.handleUncaughtExceptionsAndRejections(options.rollbar.accessToken, {
            exitOnUncaughtException: true
        });

        plugin.on('request-error', (request, err) => {

            Rollbar.handleError(err, request);
        });

        return next();
    });
};
github neighbourhoodie / voice-of-interconnect / hoodie / server / rollbar.js View on Github external
function rollbar (server, options, next) {
  if (process.env.ROLLBAR_ACCESS_TOKEN) {
    const rollbar = require('rollbar')
    rollbar.init(process.env.ROLLBAR_ACCESS_TOKEN, {
      env: process.env.NODE_ENV
    })
    rollbar.handleUncaughtExceptionsAndRejections(process.env.POST_SERVER_ITEM_ACCESS_TOKEN, {
      exitOnUncaughtException: true
    })

    server.on('log', (event, tags) => {
      if (!tags.error) {
        return
      }

      rollbar.reportMessage(event.data)
    })
  }

  next()
}