Plugins: Track SystemJS load errors with Faro (#94465)

* Test SRI check errors with Faro

* Plugins: Send SystemJS import errors to Faro

* unbork

* track loadingStrategy

* Revert "unbork"

This reverts commit 02a61f4046.

* Reapply "unbork"

This reverts commit eaee8fbb39.
This commit is contained in:
Giuseppe Guerra 2024-10-11 12:33:18 +02:00 committed by GitHub
parent 7ef38bd6c1
commit 95afb3a112
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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<GenericDataSourcePlugin> {