[core] Minor cleanup / fixed typo

This commit is contained in:
Ferdinand Thiessen 2021-03-24 20:49:54 +01:00
parent fb2febdadd
commit 27ad9984d4
1 changed files with 5 additions and 2 deletions

View File

@ -331,7 +331,7 @@ export default boot(async ({ router, app }) => {
const pluginsContext = require.context('src/plugins', true, /.+\/plugin.ts$/); const pluginsContext = require.context('src/plugins', true, /.+\/plugin.ts$/);
// Start loading plugins // Start loading plugins
// Load required modules: // Load required modules, if not found or error when loading this will forward the user to the error page
config.requiredModules.forEach((required) => { config.requiredModules.forEach((required) => {
const plugin = loadPlugin(loadedPlugins, required, pluginsContext, backend); const plugin = loadPlugin(loadedPlugins, required, pluginsContext, backend);
if (!plugin) { if (!plugin) {
@ -341,6 +341,7 @@ export default boot(async ({ router, app }) => {
}); });
// Load user defined plugins // Load user defined plugins
// If there is an error with loading a plugin, the user will get informed.
const failed: string[] = []; const failed: string[] = [];
config.loadModules.forEach((required) => { config.loadModules.forEach((required) => {
const plugin = loadPlugin(loadedPlugins, required, pluginsContext, backend); const plugin = loadPlugin(loadedPlugins, required, pluginsContext, backend);
@ -349,11 +350,13 @@ export default boot(async ({ router, app }) => {
} }
}); });
if (failed.length > 0) { if (failed.length > 0) {
// Log failed plugins
console.error('Could not load all plugins', failed); console.error('Could not load all plugins', failed);
// Inform user about error
Notify.create({ Notify.create({
type: 'negative', type: 'negative',
message: message:
'Fehler beim laden, nicht alle Funktionen stehen zur Verfügung. Bitte wende dich an den Admin!', 'Fehler beim Laden: Nicht alle Funktionen stehen zur Verfügung. Bitte wende dich an den Admin!',
timeout: 10000, timeout: 10000,
progress: true, progress: true,
}); });