Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/dbt_client/dbtCoreIntegration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,11 @@ export class DBTCoreProjectIntegration
);
this.disposables.push(
dbtProfileWatcher,
// when the project config changes we need to re-init the dbt project
...setupWatcherHandler(dbtProfileWatcher, () =>
this.rebuildManifest(),
),
// when the profile changes we need to refresh the project configuration
...setupWatcherHandler(dbtProfileWatcher, async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding error handling (e.g. a try-catch) inside the async watcher callback to log or handle failures from refreshProjectConfig or rebuildManifest. This avoids unhandled promise rejections if one of these operations fails.

await this.refreshProjectConfig();
await this.rebuildManifest();
Comment on lines +497 to +498
Copy link

Copilot AI May 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a try/catch block inside the async watcher callback to handle potential errors from refreshProjectConfig or rebuildManifest, preventing unhandled promise rejections.

Suggested change
await this.refreshProjectConfig();
await this.rebuildManifest();
try {
await this.refreshProjectConfig();
await this.rebuildManifest();
} catch (error) {
console.error("Error in watcher callback:", error);
this.telemetry.sendTelemetryError("watcherCallbackError", error);
}

Copilot uses AI. Check for mistakes.

}),
Comment on lines +496 to +499
Copy link

Copilot AI May 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Extract the inline async callback into a named method (e.g., handleProfileChange) to improve readability and allow direct testing of the handler logic.

Suggested change
...setupWatcherHandler(dbtProfileWatcher, async () => {
await this.refreshProjectConfig();
await this.rebuildManifest();
}),
...setupWatcherHandler(dbtProfileWatcher, this.handleProfileChange.bind(this)),

Copilot uses AI. Check for mistakes.

);
}
await this.createPythonDbtProject(this.python);
Expand Down
Loading