chore: remove rollbar, bump deps
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
87ae387ecb
commit
38e7369b92
1210
api-server/package-lock.json
generated
1210
api-server/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -39,7 +39,7 @@
|
|||||||
"helmet-csp": "^2.9.3",
|
"helmet-csp": "^2.9.3",
|
||||||
"jsonwebtoken": "^8.5.1",
|
"jsonwebtoken": "^8.5.1",
|
||||||
"lodash": "^4.17.15",
|
"lodash": "^4.17.15",
|
||||||
"loopback": "^3.26.0",
|
"loopback": "^3.27.0",
|
||||||
"loopback-boot": "^2.28.0",
|
"loopback-boot": "^2.28.0",
|
||||||
"loopback-connector-mongodb": "^4.2.0",
|
"loopback-connector-mongodb": "^4.2.0",
|
||||||
"method-override": "^3.0.0",
|
"method-override": "^3.0.0",
|
||||||
@ -60,7 +60,6 @@
|
|||||||
"redux-actions": "^2.6.5",
|
"redux-actions": "^2.6.5",
|
||||||
"redux-saga": "^0.16.0",
|
"redux-saga": "^0.16.0",
|
||||||
"reselect": "^3.0.1",
|
"reselect": "^3.0.1",
|
||||||
"rollbar": "^2.13.0",
|
|
||||||
"rss-parser": "^3.7.3",
|
"rss-parser": "^3.7.3",
|
||||||
"rx": "^4.1.0",
|
"rx": "^4.1.0",
|
||||||
"shortid": "^2.2.15",
|
"shortid": "^2.2.15",
|
||||||
@ -69,13 +68,13 @@
|
|||||||
"validator": "^9.4.1"
|
"validator": "^9.4.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/cli": "^7.6.4",
|
"@babel/cli": "^7.8.4",
|
||||||
"@babel/core": "^7.6.4",
|
"@babel/core": "^7.6.4",
|
||||||
"@babel/node": "^7.6.3",
|
"@babel/node": "^7.6.3",
|
||||||
"@babel/plugin-proposal-class-properties": "^7.5.5",
|
"@babel/plugin-proposal-class-properties": "^7.5.5",
|
||||||
"@babel/plugin-proposal-object-rest-spread": "^7.6.2",
|
"@babel/plugin-proposal-object-rest-spread": "^7.6.2",
|
||||||
"@babel/preset-env": "^7.6.3",
|
"@babel/preset-env": "^7.6.3",
|
||||||
"@babel/register": "^7.6.2",
|
"@babel/register": "^7.9.0",
|
||||||
"adler32": "~0.1.7",
|
"adler32": "~0.1.7",
|
||||||
"babel-core": "^7.0.0-bridge.0",
|
"babel-core": "^7.0.0-bridge.0",
|
||||||
"babel-jest": "^24.9.0",
|
"babel-jest": "^24.9.0",
|
||||||
|
@ -1,66 +0,0 @@
|
|||||||
import debug from 'debug';
|
|
||||||
import Rollbar from 'rollbar';
|
|
||||||
import {
|
|
||||||
isHandledError,
|
|
||||||
unwrapHandledError
|
|
||||||
} from '../utils/create-handled-error.js';
|
|
||||||
|
|
||||||
import { rollbar } from '../../../config/secrets';
|
|
||||||
|
|
||||||
const { appId } = rollbar;
|
|
||||||
const reporter = new Rollbar(appId);
|
|
||||||
const log = debug('fcc:middlewares:error-reporter');
|
|
||||||
|
|
||||||
const errTemplate = (error, req) => {
|
|
||||||
const { message, stack } = error;
|
|
||||||
return `
|
|
||||||
Time: ${new Date(Date.now()).toISOString()}
|
|
||||||
Error: ${message}
|
|
||||||
Is authenticated user: ${!!req.user}
|
|
||||||
Route: ${JSON.stringify(req.route, null, 2)}
|
|
||||||
Stack: ${stack}
|
|
||||||
|
|
||||||
// raw
|
|
||||||
${JSON.stringify(error, null, 2)}
|
|
||||||
|
|
||||||
`;
|
|
||||||
};
|
|
||||||
|
|
||||||
export function reportError(err) {
|
|
||||||
return process.env.FREECODECAMP_NODE_ENV === 'production' &&
|
|
||||||
process.env.ERROR_REPORTER === 'true'
|
|
||||||
? reporter.error(err.message, err)
|
|
||||||
: console.error(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function errorReporter() {
|
|
||||||
if (
|
|
||||||
process.env.FREECODECAMP_NODE_ENV !== 'production' &&
|
|
||||||
process.env.ERROR_REPORTER === 'true'
|
|
||||||
) {
|
|
||||||
return (err, req, res, next) => {
|
|
||||||
console.error(errTemplate(err, req));
|
|
||||||
|
|
||||||
if (isHandledError(err)) {
|
|
||||||
// log out user messages in development
|
|
||||||
const handled = unwrapHandledError(err);
|
|
||||||
log(handled.message);
|
|
||||||
}
|
|
||||||
next(err);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return (err, req, res, next) => {
|
|
||||||
// handled errors do not need to be reported,
|
|
||||||
// they report a message and maybe redirect the user
|
|
||||||
// errors with status codes shouldn't be reported
|
|
||||||
// as they are usually user messages
|
|
||||||
if (isHandledError(err) || err.statusCode || err.status) {
|
|
||||||
return next(err);
|
|
||||||
}
|
|
||||||
// logging the error provides us with more information,
|
|
||||||
// i.e isAuthenticatedUser, req.route
|
|
||||||
console.error(errTemplate(err, req));
|
|
||||||
reportError(err);
|
|
||||||
return next(err);
|
|
||||||
};
|
|
||||||
}
|
|
Reference in New Issue
Block a user