Debug: Update Collision (#9103)

refs #8969

- we would like to figure out how often people get the error and with which context
This commit is contained in:
Katharina Irrgang 2017-10-05 13:24:21 +02:00 committed by Kevin Ansfield
parent 7800ed3d8b
commit 30e790bf12

View File

@ -55,9 +55,16 @@ module.exports = function (Bookshelf) {
if (Object.keys(changed).length) {
if (clientUpdatedAt.diff(serverUpdatedAt) !== 0) {
// @TODO: Remove later. We want to figure out how many people experience the error in which context.
return Promise.reject(new errors.UpdateCollisionError({
message: 'Saving failed! Someone else is editing this post.',
code: 'UPDATE_COLLISION'
code: 'UPDATE_COLLISION',
level: 'critical',
context: JSON.stringify({
clientUpdatedAt: self.clientData.updated_at,
serverUpdatedAt: self.serverData.updated_at,
changed: changed
})
}));
}
}