Handle reporting of cyclic objects to Sentry

This commit is contained in:
James Allen 2016-10-26 11:34:05 +01:00
parent 032165c930
commit c9925a3590

View file

@ -233,8 +233,16 @@ define [
start = aceDelta.start
if !start?
error = new Error("aceDelta had no start event.")
JSONstringifyWithCycles = (o) ->
seen = []
return JSON.stringify o, (k,v) ->
if (typeof v == 'object')
if ( !seen.indexOf(v) )
return '__cycle__'
seen.push(v);
return v
Raven?.captureException(error, {
aceDelta: JSON.stringify(aceDelta)
aceDelta: JSONstringifyWithCycles(aceDelta)
})
throw error
linesBefore = docLines.slice(0, start.row)