Log more information in the client side errors

This commit is contained in:
James Allen 2014-03-14 17:23:50 +00:00
parent 5efd19ffc4
commit a99783edc7
3 changed files with 15 additions and 2 deletions

View file

@ -94,8 +94,11 @@ define [
INFLIGHT_OP_TIMEOUT: 10000 INFLIGHT_OP_TIMEOUT: 10000
_startInflightOpTimeout: (update) -> _startInflightOpTimeout: (update) ->
meta =
v: update.v
op_sent_at: new Date()
timer = setTimeout () => timer = setTimeout () =>
@_handleError new Error("Doc op was not acknowledged in time"), v: update.v @_handleError new Error("Doc op was not acknowledged in time"), meta
, @INFLIGHT_OP_TIMEOUT , @INFLIGHT_OP_TIMEOUT
@_doc.inflightCallbacks.push () => @_doc.inflightCallbacks.push () =>
clearTimeout timer clearTimeout timer

View file

@ -158,7 +158,13 @@ define [
} }
reportError: (error, meta = {}) -> reportError: (error, meta = {}) ->
meta.client_id = @socket.socket.sessionid meta.client_id = @socket?.socket?.sessionid
meta.transport = @socket?.socket?.transport?.name
meta.client_now = new Date()
meta.last_connected = @connectionManager.lastConnected
meta.second_last_connected = @connectionManager.secondLastConnected
meta.last_disconnected = @connectionManager.lastDisconnected
meta.second_last_disconnected = @connectionManager.secondLastDisconnected
errorObj = {} errorObj = {}
for key in Object.getOwnPropertyNames(error) for key in Object.getOwnPropertyNames(error)
errorObj[key] = error[key] errorObj[key] = error[key]

View file

@ -8,11 +8,15 @@ define [
@socket = @ide.socket @socket = @ide.socket
@socket.on "connect", () => @socket.on "connect", () =>
@connected = true @connected = true
@secondLastConnected = @lastConnected
@lastConnected = new Date()
@hideModal() @hideModal()
@cancelReconnect() @cancelReconnect()
@socket.on 'disconnect', () => @socket.on 'disconnect', () =>
@connected = false @connected = false
@secondLastDisconnected = @lastDisconnected
@lastDisconnected = new Date()
@ide.trigger "disconnect" @ide.trigger "disconnect"
setTimeout(=> setTimeout(=>
ga('send', 'event', 'editor-interaction', 'disconnect') ga('send', 'event', 'editor-interaction', 'disconnect')