mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -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'),
|
var debug = require('debug')('ghost:admin:controller'),
|
||||||
_ = require('lodash'),
|
_ = require('lodash'),
|
||||||
api = require('../api'),
|
api = require('../api'),
|
||||||
logging = require('../logging'),
|
|
||||||
updateCheck = require('../update-check'),
|
updateCheck = require('../update-check'),
|
||||||
|
logging = require('../logging'),
|
||||||
i18n = require('../i18n');
|
i18n = require('../i18n');
|
||||||
|
|
||||||
// Route: index
|
// Route: index
|
||||||
|
@ -34,5 +34,7 @@ module.exports = function adminController(req, res) {
|
||||||
});
|
});
|
||||||
}).finally(function noMatterWhat() {
|
}).finally(function noMatterWhat() {
|
||||||
res.render('default');
|
res.render('default');
|
||||||
}).catch(logging.logError);
|
}).catch(function (err) {
|
||||||
|
logging.error(err);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,6 +2,7 @@ var fs = require('fs-extra'),
|
||||||
_ = require('lodash'),
|
_ = require('lodash'),
|
||||||
config = require('../config'),
|
config = require('../config'),
|
||||||
errors = require('../errors'),
|
errors = require('../errors'),
|
||||||
|
logging = require('../logging'),
|
||||||
utils = require('../utils');
|
utils = require('../utils');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,7 +17,13 @@ module.exports = function redirects(blogApp) {
|
||||||
|
|
||||||
_.each(redirects, function (redirect) {
|
_.each(redirects, function (redirect) {
|
||||||
if (!redirect.from || !redirect.to) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +53,10 @@ module.exports = function redirects(blogApp) {
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err.code !== 'ENOENT') {
|
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…
Add table
Reference in a new issue