fix(api): error reporter should have explicit env check (#38000)

This commit is contained in:
mrugesh
2020-01-01 10:53:11 +05:30
committed by GitHub
parent fca4a885de
commit 89ddd4bb7e

View File

@ -27,7 +27,8 @@ ${JSON.stringify(error, null, 2)}
};
export function reportError(err) {
return process.env.FREECODECAMP_NODE_ENV === 'production'
return process.env.FREECODECAMP_NODE_ENV === 'production' &&
process.env.ERROR_REPORTER === 'true'
? reporter.error(err.message, err)
: console.error(err);
}
@ -35,7 +36,7 @@ export function reportError(err) {
export default function errrorReporter() {
if (
process.env.FREECODECAMP_NODE_ENV !== 'production' &&
process.env.ERROR_REPORTER
process.env.ERROR_REPORTER === 'true'
) {
return (err, req, res, next) => {
console.error(errTemplate(err, req));