mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-27 18:52:14 +03:00
Improved error context usage (#10669)
refs #10571 - Reduced the amount of log output for collision errors - Improved data passed into `errorDetails` during theme check - After discovering https://github.com/TryGhost/Ghost/blob/9810834/core/server/services/themes/index.js#L56-L57 wasn't able to remove `checkedTheme` from `context`. Left a note to be refactored later
This commit is contained in:
parent
3f52c404d4
commit
87b37556c8
@ -63,10 +63,9 @@ module.exports = function (Bookshelf) {
|
|||||||
message: 'Saving failed! Someone else is editing this post.',
|
message: 'Saving failed! Someone else is editing this post.',
|
||||||
code: 'UPDATE_COLLISION',
|
code: 'UPDATE_COLLISION',
|
||||||
level: 'critical',
|
level: 'critical',
|
||||||
context: {
|
errorDetails: {
|
||||||
clientUpdatedAt: self.clientData.updated_at,
|
clientUpdatedAt: self.clientData.updated_at,
|
||||||
serverUpdatedAt: self.serverData.updated_at,
|
serverUpdatedAt: self.serverData.updated_at
|
||||||
changed: changed
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
var Promise = require('bluebird'),
|
const _ = require('lodash');
|
||||||
config = require('../../config'),
|
const Promise = require('bluebird');
|
||||||
common = require('../../lib/common'),
|
const config = require('../../config');
|
||||||
checkTheme;
|
const common = require('../../lib/common');
|
||||||
|
|
||||||
|
let checkTheme;
|
||||||
|
|
||||||
checkTheme = function checkTheme(theme, isZip) {
|
checkTheme = function checkTheme(theme, isZip) {
|
||||||
var checkPromise,
|
var checkPromise,
|
||||||
@ -31,7 +33,13 @@ checkTheme = function checkTheme(theme, isZip) {
|
|||||||
|
|
||||||
return Promise.reject(new common.errors.ThemeValidationError({
|
return Promise.reject(new common.errors.ThemeValidationError({
|
||||||
message: common.i18n.t('errors.api.themes.invalidTheme'),
|
message: common.i18n.t('errors.api.themes.invalidTheme'),
|
||||||
errorDetails: checkedTheme.results.error,
|
errorDetails: Object.assign(
|
||||||
|
_.pick(checkedTheme, ['checkedVersion', 'name', 'path', 'version']), {
|
||||||
|
errors: checkedTheme.results.error
|
||||||
|
}
|
||||||
|
),
|
||||||
|
// NOTE: needs to be removed but first has to be decoupled
|
||||||
|
// from logic here: https://github.com/TryGhost/Ghost/blob/9810834/core/server/services/themes/index.js#L56-L57
|
||||||
context: checkedTheme
|
context: checkedTheme
|
||||||
}));
|
}));
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user