mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
[misc] OError.tag all the errors in async contexts
See the docs of OError.tag: https://github.com/overleaf/o-error#long-stack-traces-with-oerrortag (currently at 221dd902e7bfa0ee92de1ea5a3cbf3152c3ceeb4) I am tagging all errors at each async hop. Most of the controller code will only ever see already tagged errors -- or new errors created in our app code. They should have enough info that we do not need to tag them again.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable
|
||||
camelcase,
|
||||
*/
|
||||
const OError = require('@overleaf/o-error')
|
||||
const logger = require('logger-sharelatex')
|
||||
const metrics = require('metrics-sharelatex')
|
||||
const WebApiManager = require('./WebApiManager')
|
||||
@@ -91,7 +92,14 @@ module.exports = WebsocketController = {
|
||||
client.publicId,
|
||||
user,
|
||||
null,
|
||||
function () {}
|
||||
function (err) {
|
||||
if (err) {
|
||||
logger.warn(
|
||||
{ err, project_id, user_id, client_id: client.id },
|
||||
'background cursor update failed'
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
},
|
||||
@@ -229,17 +237,7 @@ module.exports = WebsocketController = {
|
||||
try {
|
||||
line = encodeForWebsockets(line)
|
||||
} catch (err) {
|
||||
logger.err(
|
||||
{
|
||||
err,
|
||||
project_id,
|
||||
doc_id,
|
||||
fromVersion,
|
||||
line,
|
||||
client_id: client.id
|
||||
},
|
||||
'error encoding line uri component'
|
||||
)
|
||||
OError.tag(err, 'error encoding line uri component', { line })
|
||||
return callback(err)
|
||||
}
|
||||
escapedLines.push(line)
|
||||
@@ -260,17 +258,9 @@ module.exports = WebsocketController = {
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
logger.err(
|
||||
{
|
||||
err,
|
||||
project_id,
|
||||
doc_id,
|
||||
fromVersion,
|
||||
ranges,
|
||||
client_id: client.id
|
||||
},
|
||||
'error encoding range uri component'
|
||||
)
|
||||
OError.tag(err, 'error encoding range uri component', {
|
||||
ranges
|
||||
})
|
||||
return callback(err)
|
||||
}
|
||||
}
|
||||
@@ -538,16 +528,9 @@ module.exports = WebsocketController = {
|
||||
}
|
||||
|
||||
if (error) {
|
||||
logger.error(
|
||||
{
|
||||
err: error,
|
||||
project_id,
|
||||
doc_id,
|
||||
client_id: client.id,
|
||||
version: update.v
|
||||
},
|
||||
'document was not available for update'
|
||||
)
|
||||
OError.tag(error, 'document was not available for update', {
|
||||
version: update.v
|
||||
})
|
||||
client.disconnect()
|
||||
}
|
||||
callback(error)
|
||||
|
||||
Reference in New Issue
Block a user