mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Plugins: Send SystemJS import errors to Faro
This commit is contained in:
parent
818ff761cc
commit
a17d2865ae
@ -23,6 +23,7 @@ import { SystemJSWithLoaderHooks } from './loader/types';
|
|||||||
import { buildImportMap, resolveModulePath } from './loader/utils';
|
import { buildImportMap, resolveModulePath } from './loader/utils';
|
||||||
import { importPluginModuleInSandbox } from './sandbox/sandbox_plugin_loader';
|
import { importPluginModuleInSandbox } from './sandbox/sandbox_plugin_loader';
|
||||||
import { isFrontendSandboxSupported } from './sandbox/utils';
|
import { isFrontendSandboxSupported } from './sandbox/utils';
|
||||||
|
import { pluginsLogger } from './utils';
|
||||||
|
|
||||||
const imports = buildImportMap(sharedDependenciesMap);
|
const imports = buildImportMap(sharedDependenciesMap);
|
||||||
|
|
||||||
@ -118,7 +119,18 @@ export async function importPluginModule({
|
|||||||
return importPluginModuleInSandbox({ pluginId });
|
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 ?? '',
|
||||||
|
sriChecksEnabled: (config.featureToggles.pluginsSriChecks ?? false).toString(),
|
||||||
|
});
|
||||||
|
throw error;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function importDataSourcePlugin(meta: DataSourcePluginMeta): Promise<GenericDataSourcePlugin> {
|
export function importDataSourcePlugin(meta: DataSourcePluginMeta): Promise<GenericDataSourcePlugin> {
|
||||||
|
Loading…
Reference in New Issue
Block a user