Skip to content

Commit 17792be

Browse files
authored
feat: add error handling for extension activation (#1741)
1 parent 8faece2 commit 17792be

File tree

1 file changed

+26
-22
lines changed

1 file changed

+26
-22
lines changed

src/dbtPowerUserExtension.ts

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -94,29 +94,33 @@ export class DBTPowerUserExtension implements Disposable {
9494
}
9595

9696
async activate(context: ExtensionContext): Promise<void> {
97-
await this.mcpServer.updateMcpExtensionApi();
98-
this.dbtProjectContainer.setContext(context);
99-
this.dbtProjectContainer.initializeWalkthrough();
100-
await this.dbtProjectContainer.detectDBT();
101-
await this.dbtProjectContainer.initializeDBTProjects();
102-
await this.statusBars.initialize();
103-
// Ask to reload the window if the dbt integration changes
104-
const dbtIntegration = workspace
105-
.getConfiguration("dbt")
106-
.get<string>("dbtIntegration", "core");
107-
workspace.onDidChangeConfiguration((e) => {
108-
if (!e.affectsConfiguration("dbt")) {
109-
return;
110-
}
111-
const newDbtIntegration = workspace
97+
try {
98+
await this.mcpServer.updateMcpExtensionApi();
99+
this.dbtProjectContainer.setContext(context);
100+
this.dbtProjectContainer.initializeWalkthrough();
101+
await this.dbtProjectContainer.detectDBT();
102+
await this.dbtProjectContainer.initializeDBTProjects();
103+
await this.statusBars.initialize();
104+
// Ask to reload the window if the dbt integration changes
105+
const dbtIntegration = workspace
112106
.getConfiguration("dbt")
113107
.get<string>("dbtIntegration", "core");
114-
if (
115-
dbtIntegration !== newDbtIntegration &&
116-
["core", "cloud", "corecommand", "fusion"].includes(newDbtIntegration)
117-
) {
118-
commands.executeCommand("workbench.action.reloadWindow");
119-
}
120-
});
108+
workspace.onDidChangeConfiguration((e) => {
109+
if (!e.affectsConfiguration("dbt")) {
110+
return;
111+
}
112+
const newDbtIntegration = workspace
113+
.getConfiguration("dbt")
114+
.get<string>("dbtIntegration", "core");
115+
if (
116+
dbtIntegration !== newDbtIntegration &&
117+
["core", "cloud", "corecommand", "fusion"].includes(newDbtIntegration)
118+
) {
119+
commands.executeCommand("workbench.action.reloadWindow");
120+
}
121+
});
122+
} catch (error) {
123+
this.telemetry.sendTelemetryError("extensionActivationError", error);
124+
}
121125
}
122126
}

0 commit comments

Comments
 (0)