Skip to content

Commit

Permalink
Fixed error logging bug
Browse files Browse the repository at this point in the history
  • Loading branch information
omgimanerd committed Aug 9, 2017
1 parent 9a86370 commit 71dc441
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions server/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ const fetchArticles = source => {
}
return results
}).catch(error => {
return errorBuilder.promise('NewsAPIArticlesShorteningError',
error.error ? error.error : error)
return error.error ? errorBuilder.promise('NewsAPIArticlesShorteningError',
error.error) : error
})
}

Expand Down
8 changes: 5 additions & 3 deletions server/loggers.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = exports = (options) => {
if (PROD_MODE && (!USERNAME || !PASSWORD || !ALERT_EMAIL)) {
throw new Error('Production configuration not provided!')
}

const analyticsFile = options.analyticsFile
const errorFile = options.errorFile

Expand All @@ -41,7 +41,7 @@ module.exports = exports = (options) => {
host: 'smtp.gmail.com',
username: USERNAME,
password: PASSWORD,
subject: 'NYCURL ERROR',
subject: 'GETNEWS.TECH ERROR',
ssl: true
}))
}
Expand Down Expand Up @@ -69,7 +69,9 @@ module.exports = exports = (options) => {
colorize: true,
dynamicMeta: dynamicMetaFunction
}),
errorLogger: expressWinston.errorLogger({
// We are using a plain winston logger here because we will invoke this
// logger's logging methods manually instead of using it as middleware.
errorLogger: new winston.Logger({
transports: errorTransports
})
}
Expand Down

0 comments on commit 71dc441

Please sign in to comment.