2
1
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2023-12-13 21:00:40 +01:00

🐛 fix usages of logError (#8138)

no issue
This commit is contained in:
Katharina Irrgang 2017-03-13 20:47:09 +01:00 committed by Hannah Wolfe
parent e060a4f811
commit ea0f696c4d
2 changed files with 16 additions and 4 deletions

View file

@ -1,8 +1,8 @@
var debug = require('debug')('ghost:admin:controller'),
_ = require('lodash'),
api = require('../api'),
logging = require('../logging'),
updateCheck = require('../update-check'),
logging = require('../logging'),
i18n = require('../i18n');
// Route: index
@ -34,5 +34,7 @@ module.exports = function adminController(req, res) {
});
}).finally(function noMatterWhat() {
res.render('default');
}).catch(logging.logError);
}).catch(function (err) {
logging.error(err);
});
};

View file

@ -2,6 +2,7 @@ var fs = require('fs-extra'),
_ = require('lodash'),
config = require('../config'),
errors = require('../errors'),
logging = require('../logging'),
utils = require('../utils');
/**
@ -16,7 +17,13 @@ module.exports = function redirects(blogApp) {
_.each(redirects, function (redirect) {
if (!redirect.from || !redirect.to) {
errors.logError(null, 'Your redirects.json file is in a wrong format');
logging.warn(new errors.IncorrectUsageError({
message: 'One of your custom redirects is in a wrong format.',
level: 'normal',
help: JSON.stringify(redirect),
context: 'redirects.json'
}));
return;
}
@ -46,7 +53,10 @@ module.exports = function redirects(blogApp) {
});
} catch (err) {
if (err.code !== 'ENOENT') {
errors.logAndThrowError(err, 'Your redirects.json is broken.', 'Check if your JSON is valid.');
logging.error(new errors.IncorrectUsageError({
message: 'Your redirects.json is broken.',
help: 'Check if your JSON is valid.'
}));
}
}
};