From 1e54b4c72c2484c7c7b919cb6af414c3a738e61b Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Thu, 7 Sep 2017 14:12:48 +0100 Subject: [PATCH 1/2] log all errors in getProjectDocs --- .../app/coffee/ProjectManager.coffee | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/services/document-updater/app/coffee/ProjectManager.coffee b/services/document-updater/app/coffee/ProjectManager.coffee index 60446485b0..6aa7b14434 100644 --- a/services/document-updater/app/coffee/ProjectManager.coffee +++ b/services/document-updater/app/coffee/ProjectManager.coffee @@ -65,12 +65,16 @@ module.exports = ProjectManager = _callback(args...) RedisManager.checkOrSetProjectState project_id, projectStateHash, (error, projectStateChanged) -> - return callback(error) if error? + if error? + logger.error err: error, project_id: project_id, "error getting/setting project state in getProjectDocs" + return callback(error) # we can't return docs if project structure has changed return callback Errors.ProjectStateChangedError("project state changed") if projectStateChanged # project structure hasn't changed, return doc content from redis RedisManager.getDocIdsInProject project_id, (error, doc_ids) -> - return callback(error) if error? + if error? + logger.error err: error, project_id: project_id, "error getting doc ids in getProjectDocs" + return callback(error) jobs = [] docs = [] for doc_id in doc_ids or [] @@ -79,18 +83,21 @@ module.exports = ProjectManager = # check the doc version first RedisManager.getDocVersion doc_id, (error, version) -> if error? - logger.error err: error, project_id: project_id, doc_id: doc_id, "error getting project doc version" + logger.error err: error, project_id: project_id, doc_id: doc_id, "error getting project doc version in getProjectDocs" return cb(error) # skip getting the doc if we already have that version - return cb() if version? and version is excludeVersions[doc_id] + if version? and version is excludeVersions[doc_id] + logger.error err: error, project_id: project_id, doc_id: doc_id, version: version, "skipping doc version in getProjectDocs" + return cb() # otherwise get the doc lines from redis RedisManager.getDocLines doc_id, (error, lines) -> if error? - logger.error err: error, project_id: project_id, doc_id: doc_id, "error getting project doc lines" + logger.error err: error, project_id: project_id, doc_id: doc_id, "error getting project doc lines in getProjectDocs" return cb(error) try docs.push {_id: doc_id, lines: JSON.parse(lines), v: version} catch e + logger.error err: e, project_id: project_id, doc_id: doc_id, lines: lines, version: version, "error parsing doc lines in getProjectDocs" return cb(e) cb() async.series jobs, (error) -> From 215a939d4e37f21840e7bddea78e6fd5894bb348 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Fri, 8 Sep 2017 13:43:22 +0100 Subject: [PATCH 2/2] add comment about log.error for excludeVersions --- services/document-updater/app/coffee/ProjectManager.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/document-updater/app/coffee/ProjectManager.coffee b/services/document-updater/app/coffee/ProjectManager.coffee index 6aa7b14434..a6621d1be0 100644 --- a/services/document-updater/app/coffee/ProjectManager.coffee +++ b/services/document-updater/app/coffee/ProjectManager.coffee @@ -87,6 +87,8 @@ module.exports = ProjectManager = return cb(error) # skip getting the doc if we already have that version if version? and version is excludeVersions[doc_id] + # not currently using excludeVersions so we shouldn't get here! + # change to logger.log when this code path is in use logger.error err: error, project_id: project_id, doc_id: doc_id, version: version, "skipping doc version in getProjectDocs" return cb() # otherwise get the doc lines from redis