How to use the rollbar.errorHandler 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 keyz / repo.cat / index.js View on Github external
const app = express();

const IPAddress = '0.0.0.0';
const PORT = JSON.parse(process.env.PORT || 5000);
const ROOT_PATH = `${__dirname}/dist`;

app.use(compression());

app.use(express.static(ROOT_PATH));

app.get('*', (req, res) => {
  res.sendFile('index.html', { root: ROOT_PATH });
});

app.use(rollbar.errorHandler('13b7c2facd104874ac16204769da9c0b', {
  environment: 'production',
  exitOnUncaughtException: true,
}));

app.listen(PORT, IPAddress, (err) => {
  if (err) {
    console.log(err); // eslint-disable-line no-console
    return;
  }

  console.log(`Listening at http://${IPAddress}:${PORT}`); // eslint-disable-line no-console
});
github WikiWatershed / model-my-watershed / src / tiler / server.js View on Github external
req.params.dbname = dbName;
            req.params.style = styles;
            req.params.interactivity = interactivity[tableName];
            callback(null, req);
        } catch (ex) {
            rollbar.handleError(ex, req);
            callback(ex, null);
        }
    }
};

// Initialize tile server on port 4000
var ws = new Windshaft.Server(config);
ws.get('/health-check', healthCheck(config));
ws.listen(4000);
ws.use(rollbar.errorHandler(rollbarAccessToken, {environment: stackType}));
console.log('Starting MMW Windshaft tiler on http://localhost:4000' + config.base_url + '/:z/:x/:y.*');
github blueberryapps / haystack / src / server / main.js View on Github external
app.use(helmet.ieNoOpen());
app.use(helmet.noSniff());

// Middlewares
app.use(morgan('dev'));
app.use(compression());
app.use(cookieParser());

// Apps
app.use('/api', api);
app.use(frontend);

// Error reporter
if (process.env.ROLLBAR_SERVER_TOKEN && process.env.APP_ENV !== 'development') {
  console.log('Error reporting to rollbar with TOKEN %s and ENV %s', process.env.ROLLBAR_SERVER_TOKEN, process.env.APP_ENV);
  app.use(rollbar.errorHandler(process.env.ROLLBAR_SERVER_TOKEN, { environment: process.env.APP_ENV }));
}

// Error handler
app.use(errorHandler);

export default app;
github JustFixNYC / tenants / config / express.js View on Github external
app.set('view engine', 'server.view.html');
	app.set('views', './app/views');

	// Environment dependent middleware
	if (process.env.NODE_ENV === 'development') {
		// Enable logger (morgan)
		// app.use(morgan('dev'));

		// Disable views cache
		app.set('view cache', false);
	} else if (process.env.NODE_ENV === 'production') {
		app.locals.cache = 'memory';
	}

	// Use the rollbar error handler to send exceptions to your rollbar account
	app.use(rollbar.errorHandler(config.rollbar.servertoken, { environment: process.env.NODE_ENV }));

	// Use for rollbar client-side errors
	app.locals.env = process.env.NODE_ENV;
	app.locals.rollbar = config.rollbar.clienttoken;

	app.locals.heap = config.heap.token;

	// handles uncaught exceptions and unhandled promises
	// I dont think this makes sense here... RTFM
	// rollbar.handleUncaughtExceptionsAndRejections(process.env.ROLLBAR_ACCESS_TOKEN);


	// Request body parsing middleware should be above methodOverride
	app.use(bodyParser.urlencoded({
		extended: true
	}));