Merge pull request #1190 from CartoDB/feature/ch101625/node-windshaft-exiting-because-of-typeerror

Fix logger error serializer when the exception stack is not set
This commit is contained in:
Daniel G. Aubert 2020-09-09 14:07:23 +02:00 committed by GitHub
commit d79f1b41d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,7 +9,9 @@ module.exports = class Logger {
const { LOG_LEVEL, NODE_ENV } = process.env;
const logLevelFromNodeEnv = NODE_ENV === 'test' ? 'fatal' : 'info';
const errorSerializer = DEV_ENVS.includes(NODE_ENV) ? err : wrapErrorSerializer(err => {
err.stack = err.stack.split('\n').slice(0, 3).join('\n');
if (Object.prototype.hasOwnProperty.call(err, 'stack')) {
err.stack = err.stack.split('\n').slice(0, 3).join('\n');
}
return err;
});
const options = {