Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
fix: print errors when failed to load extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
rot1024 committed Sep 8, 2022
1 parent 6a6d98e commit 35a63f2
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/config/extensions.ts
Expand Up @@ -84,21 +84,17 @@ export async function loadExtensions(urls?: string[]): Promise<Extensions | unde
for (const url of urls) {
try {
const newExtensions: Extension[] = (await import(/* @vite-ignore */ url)).default;
newExtensions.forEach(ext =>
ext.type === "dataset-import"
? datasetImport.push(ext as Extension<"dataset-import">)
: ext.type === "publication"
? publication.push(ext as Extension<"publication">)
: ext.type === "plugin-library"
? pluginLibrary.push(ext as Extension<"plugin-library">)
: ext.type === "plugin-installed"
? pluginInstalled.push(ext as Extension<"plugin-installed">)
: ext.type === "global-modal"
? globalModal.push(ext as Extension<"global-modal">)
: undefined,
);
newExtensions.forEach(ext => {
if (ext.type === "dataset-import") datasetImport.push(ext as Extension<"dataset-import">);
else if (ext.type === "publication") publication.push(ext as Extension<"publication">);
else if (ext.type === "plugin-library")
pluginLibrary.push(ext as Extension<"plugin-library">);
else if (ext.type === "plugin-installed")
pluginInstalled.push(ext as Extension<"plugin-installed">);
else if (ext.type === "global-modal") globalModal.push(ext as Extension<"global-modal">);
});
} catch (e) {
// ignore
console.error("extension load failed", e);
}
}

Expand Down

0 comments on commit 35a63f2

Please sign in to comment.