diff --git a/public/app/features/plugins/plugin_loader.ts b/public/app/features/plugins/plugin_loader.ts index 3fa1f3bf98d..6d7ace4e8ca 100644 --- a/public/app/features/plugins/plugin_loader.ts +++ b/public/app/features/plugins/plugin_loader.ts @@ -23,6 +23,7 @@ import { SystemJSWithLoaderHooks } from './loader/types'; import { buildImportMap, resolveModulePath } from './loader/utils'; import { importPluginModuleInSandbox } from './sandbox/sandbox_plugin_loader'; import { isFrontendSandboxSupported } from './sandbox/utils'; +import { pluginsLogger } from './utils'; const imports = buildImportMap(sharedDependenciesMap); @@ -118,7 +119,19 @@ export async function importPluginModule({ return importPluginModuleInSandbox({ pluginId }); } - return SystemJS.import(modulePath); + return SystemJS.import(modulePath).catch((e) => { + let error = new Error('Could not load plugin: ' + e); + console.error(error); + pluginsLogger.logError(error, { + path, + pluginId, + pluginVersion: version ?? '', + expectedHash: moduleHash ?? '', + loadingStrategy: loadingStrategy.toString(), + sriChecksEnabled: (config.featureToggles.pluginsSriChecks ?? false).toString(), + }); + throw error; + }); } export function importDataSourcePlugin(meta: DataSourcePluginMeta): Promise {