convert errors to warnings

This commit is contained in:
Brian Gough 2017-11-10 15:01:23 +00:00
parent 3b39464aa5
commit b734f7a3f7
3 changed files with 4 additions and 4 deletions

View file

@ -36,7 +36,7 @@ module.exports = DocumentUpdaterController =
_processErrorFromDocumentUpdater: (io, doc_id, error, message) ->
for client in io.sockets.clients(doc_id)
logger.error err: error, doc_id: doc_id, client_id: client.id, "error from document updater, disconnecting client"
logger.warn err: error, doc_id: doc_id, client_id: client.id, "error from document updater, disconnecting client"
client.emit "otUpdateError", error, message
client.disconnect()

View file

@ -21,7 +21,7 @@ module.exports = Router =
attrs[key] = value
attrs.client_id = client.id
attrs.err = error
if error.message in ["not authorized", "doc updater could not load requested ops"]
if error.message in ["not authorized", "doc updater could not load requested ops", "no project_id found on client"]
logger.warn attrs, error.message
return callback {message: error.message}
else
@ -40,7 +40,7 @@ module.exports = Router =
session.on 'connection', (error, client, session) ->
if client? and error?.message?.match(/could not look up session by key/)
logger.err err: error, client: client?, session: session?, "invalid session"
logger.warn err: error, client: client?, session: session?, "invalid session"
# tell the client to reauthenticate if it has an invalid session key
client.emit("connectionRejected", {message: "invalid session"})
client.disconnect()

View file

@ -182,7 +182,7 @@ module.exports = WebsocketController =
return callback(new Error("no project_id found on client")) if !project_id?
WebsocketController._assertClientCanApplyUpdate client, doc_id, update, (error) ->
if error?
logger.error {err: error, doc_id, client_id: client.id, version: update.v}, "client is not authorized to make update"
logger.warn {err: error, doc_id, client_id: client.id, version: update.v}, "client is not authorized to make update"
setTimeout () ->
# Disconnect, but give the client the chance to receive the error
client.disconnect()