MCPcopy Create free account
hub / github.com/bytebase/dbhub / loadConnectors

Function loadConnectors

src/utils/module-loader.ts:56–82  ·  view source on GitHub ↗
(
  connectorModules: ConnectorModule[]
)

Source from the content-addressed store, hash-verified

54 * is not installed.
55 */
56export async function loadConnectors(
57 connectorModules: ConnectorModule[]
58): Promise<void> {
59 await Promise.all(
60 connectorModules.map(async ({ load, name, driver }) => {
61 try {
62 await load();
63 } catch (err) {
64 if (isDriverNotInstalled(err, driver)) {
65 console.error(
66 `Skipping ${name} connector: driver package "${driver}" not installed.`
67 );
68 } else if (isModuleNotFound(err)) {
69 // Transitive dependency missing (e.g. mssql installed but @azure/core-client is not)
70 const msg = err instanceof Error ? err.message : String(err);
71 const match = msg.match(MISSING_MODULE_RE);
72 const missing = match ? match[1] : "unknown";
73 console.error(
74 `Skipping ${name} connector: required dependency "${missing}" not installed.`
75 );
76 } else {
77 throw err;
78 }
79 }
80 })
81 );
82}

Callers 2

index.tsFile · 0.85

Calls 2

isDriverNotInstalledFunction · 0.85
isModuleNotFoundFunction · 0.85

Tested by

no test coverage detected