diff --git a/services/project-history/app/js/DiffManager.js b/services/project-history/app/js/DiffManager.js index 75cf9afa56..69c9b2f4ed 100644 --- a/services/project-history/app/js/DiffManager.js +++ b/services/project-history/app/js/DiffManager.js @@ -37,7 +37,18 @@ export function getDiff(projectId, pathname, fromVersion, toVersion, callback) { if (binary) { diff = { binary: true } } else { - diff = DiffGenerator.buildDiff(initialContent, updates) + try { + diff = DiffGenerator.buildDiff(initialContent, updates) + } catch (err) { + return callback( + OError.tag(err, 'failed to build diff', { + projectId, + pathname, + fromVersion, + toVersion, + }) + ) + } } callback(null, diff) }