mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
parent
e060a4f811
commit
ea0f696c4d
2 changed files with 16 additions and 4 deletions
|
@ -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);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -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.'
|
||||
}));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue