mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 06:35:49 +03:00
🐛 Added 409 UpdateCollisionError for the editor (#8899)
fixes #8898 - This is a user error, not a system error - Downgrading to a 4xx status code means it doesn't appear in logs where it shouldn't - We didn't have a suitable error available so I added UpdateCollisionError with 409 status
This commit is contained in:
parent
340532136e
commit
512808e8b4
@ -60,6 +60,12 @@ var ghostErrors = {
|
||||
statusCode: 409,
|
||||
errorType: 'DisabledFeatureError',
|
||||
}, options));
|
||||
},
|
||||
UpdateCollisionError: function UpdateCollisionError(options) {
|
||||
GhostError.call(this, _.merge({
|
||||
statusCode: 409,
|
||||
errorType: 'UpdateCollisionError',
|
||||
}, options));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -55,7 +55,7 @@ module.exports = function (Bookshelf) {
|
||||
|
||||
if (Object.keys(changed).length) {
|
||||
if (clientUpdatedAt.diff(serverUpdatedAt) !== 0) {
|
||||
return Promise.reject(new errors.InternalServerError({
|
||||
return Promise.reject(new errors.UpdateCollisionError({
|
||||
message: 'Saving failed! Someone else is editing this post.',
|
||||
code: 'UPDATE_COLLISION'
|
||||
}));
|
||||
|
Loading…
Reference in New Issue
Block a user