fix(api): error reporter should have explicit env check (#38000)
This commit is contained in:
@ -27,7 +27,8 @@ ${JSON.stringify(error, null, 2)}
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function reportError(err) {
|
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)
|
? reporter.error(err.message, err)
|
||||||
: console.error(err);
|
: console.error(err);
|
||||||
}
|
}
|
||||||
@ -35,7 +36,7 @@ export function reportError(err) {
|
|||||||
export default function errrorReporter() {
|
export default function errrorReporter() {
|
||||||
if (
|
if (
|
||||||
process.env.FREECODECAMP_NODE_ENV !== 'production' &&
|
process.env.FREECODECAMP_NODE_ENV !== 'production' &&
|
||||||
process.env.ERROR_REPORTER
|
process.env.ERROR_REPORTER === 'true'
|
||||||
) {
|
) {
|
||||||
return (err, req, res, next) => {
|
return (err, req, res, next) => {
|
||||||
console.error(errTemplate(err, req));
|
console.error(errTemplate(err, req));
|
||||||
|
Reference in New Issue
Block a user