Explorar el Código

log attempted update when throwing error in DiffGenerator

Brian Gough hace 10 años
padre
commit
1a1fa8798d
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      services/track-changes/app/coffee/DiffGenerator.coffee

+ 5 - 1
services/track-changes/app/coffee/DiffGenerator.coffee

@@ -50,7 +50,11 @@ module.exports = DiffGenerator =
 
 	rewindUpdates: (content, updates) ->
 		for update in updates.reverse()
-			content = DiffGenerator.rewindUpdate(content, update)
+			try
+				content = DiffGenerator.rewindUpdate(content, update)
+			catch e
+				e.attempted_update = update # keep a record of the attempted update
+				throw e # rethrow the exception
 		return content
 
 	buildDiff: (initialContent, updates) ->