Ghost/core/frontend/services/apps/index.js
Hannah Wolfe ac07703f17
Changed app/loader to use @tryghost/errors
- getting rid of instances of new Error as we should always use @tryghost/errors
- Whilst here, got rid of i18n but discovered the messages were missing!
- This is my fault, they disappeared when I removed external apps and clearly removed too much: 8c1a0b8d0c (diff-0f5cc40aa8906a1be1bad2002a35361bbf9e766e46b3b29be10f4f479265426a)
- Therefore, I have restored these messages in the places where they were used, except amp_content, where I have written a new message, as the message that was there was not relevant
2021-06-30 16:05:54 +01:00

29 lines
1.0 KiB
JavaScript

const debug = require('@tryghost/debug')('services:apps');
const Promise = require('bluebird');
const tpl = require('@tryghost/tpl');
const logging = require('@tryghost/logging');
const errors = require('@tryghost/errors');
const config = require('../../../shared/config');
const loader = require('./loader');
const messages = {
appWillNotBeLoadedError: 'The app will not be loaded',
appWillNotBeLoadedHelp: 'Check with the app creator, or read the app documentation for more details on app requirements'
};
module.exports = {
init: function () {
debug('init begin');
const appsToLoad = config.get('apps:internal');
return Promise.map(appsToLoad, appName => loader.activateAppByName(appName))
.catch(function (err) {
logging.error(new errors.GhostError({
err: err,
context: tpl(messages.appWillNotBeLoadedError),
help: tpl(messages.appWillNotBeLoadedHelp)
}));
});
}
};