refactor(server): Remove opbeat from dev tools
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
13162cb53a
commit
0553bfe2ff
@ -99,7 +99,6 @@
|
||||
"nodemailer-ses-transport": "^1.3.0",
|
||||
"normalize-url": "^1.3.1",
|
||||
"normalizr": "2.2.1",
|
||||
"opbeat": "^4.14.0",
|
||||
"passport": "^0.4.0",
|
||||
"passport-facebook": "^2.0.0",
|
||||
"passport-github": "^1.0.0",
|
||||
|
@ -1,4 +1,3 @@
|
||||
import opbeat from 'opbeat';
|
||||
import debug from 'debug';
|
||||
|
||||
import {
|
||||
@ -8,7 +7,6 @@ import {
|
||||
|
||||
const log = debug('fcc:middlewares:error-reporter');
|
||||
|
||||
const isOpbeatDisabled = !opbeat.appId;
|
||||
export default function errrorReporter() {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
return (err, req, res, next) => {
|
||||
@ -18,21 +16,7 @@ export default function errrorReporter() {
|
||||
log(handled.message);
|
||||
}
|
||||
next(err);
|
||||
};
|
||||
};
|
||||
}
|
||||
return (err, req, res, next) => {
|
||||
// handled errors do not need to be reported
|
||||
// the report a message and redirect the user
|
||||
if (
|
||||
isOpbeatDisabled ||
|
||||
isHandledError(err) ||
|
||||
// errors with status codes shouldn't be reported
|
||||
// as they are usually user messages
|
||||
err.statusCode ||
|
||||
err.status
|
||||
) {
|
||||
return next(err);
|
||||
}
|
||||
return opbeat.captureError(err, { request: req }, () => next(err));
|
||||
};
|
||||
return (err, req, res, next) => next(err);
|
||||
}
|
||||
|
@ -1,15 +1,6 @@
|
||||
require('dotenv').load();
|
||||
require('./utils/webpack-code-split-polyfill');
|
||||
|
||||
if (process.env.OPBEAT_ID) {
|
||||
console.log('loading opbeat');
|
||||
require('opbeat').start({
|
||||
appId: process.env.OPBEAT_ID,
|
||||
organizationId: process.env.OPBEAT_ORG_ID,
|
||||
secretToken: process.env.OPBEAT_SECRET
|
||||
});
|
||||
}
|
||||
|
||||
const _ = require('lodash');
|
||||
const Rx = require('rx');
|
||||
const loopback = require('loopback');
|
||||
|
Reference in New Issue
Block a user