Skip to content

Commit f7ae3cb

Browse files
committed
fix: clarify DCG enablement errors
1 parent eaff17a commit f7ae3cb

20 files changed

Lines changed: 44 additions & 46 deletions

src/core/webview/__tests__/webviewMessageHandler.spec.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,7 @@ describe("webviewMessageHandler - destructiveCommandGuardEnabled", () => {
11301130

11311131
expect(mockClineProvider.contextProxy.setValue).toHaveBeenCalledWith("destructiveCommandGuardEnabled", false)
11321132
expect(vscode.window.showErrorMessage).toHaveBeenCalledWith(
1133-
"common:errors.destructive_command_guard_enable_failed",
1133+
"common:errors.destructiveCommandGuard.enableFailed",
11341134
)
11351135
})
11361136

@@ -1143,12 +1143,9 @@ describe("webviewMessageHandler - destructiveCommandGuardEnabled", () => {
11431143
})
11441144

11451145
expect(mockClineProvider.contextProxy.setValue).toHaveBeenCalledWith("destructiveCommandGuardEnabled", false)
1146-
expect(t).toHaveBeenCalledWith("common:errors.destructive_command_guard_enable_failed", {
1147-
error: "common:errors.destructiveCommandGuard.unavailable",
1148-
})
1149-
expect(vscode.window.showErrorMessage).toHaveBeenCalledWith(
1150-
"common:errors.destructive_command_guard_enable_failed",
1151-
)
1146+
expect(t).toHaveBeenCalledWith("common:errors.destructiveCommandGuard.unavailable")
1147+
expect(vscode.window.showErrorMessage).toHaveBeenCalledWith("common:errors.destructiveCommandGuard.unavailable")
1148+
expect(t).not.toHaveBeenCalledWith("common:errors.destructiveCommandGuard.enableFailed", expect.anything())
11521149
})
11531150

11541151
it("reports non-Error installation failures", async () => {
@@ -1160,7 +1157,7 @@ describe("webviewMessageHandler - destructiveCommandGuardEnabled", () => {
11601157
})
11611158

11621159
expect(mockClineProvider.contextProxy.setValue).toHaveBeenCalledWith("destructiveCommandGuardEnabled", false)
1163-
expect(t).toHaveBeenCalledWith("common:errors.destructive_command_guard_enable_failed", {
1160+
expect(t).toHaveBeenCalledWith("common:errors.destructiveCommandGuard.enableFailed", {
11641161
error: "download unavailable",
11651162
})
11661163
})

src/core/webview/webviewMessageHandler.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,12 +686,13 @@ export const webviewMessageHandler = async (
686686
const { ensureDcgInstalled } = await import("../../services/destructive-command-guard")
687687
const binaryPath = await ensureDcgInstalled(provider.context.globalStorageUri.fsPath)
688688
if (!binaryPath) {
689-
throw new Error(t("common:errors.destructiveCommandGuard.unavailable"))
689+
message.updatedSettings.destructiveCommandGuardEnabled = false
690+
vscode.window.showErrorMessage(t("common:errors.destructiveCommandGuard.unavailable"))
690691
}
691692
} catch (error) {
692693
message.updatedSettings.destructiveCommandGuardEnabled = false
693694
vscode.window.showErrorMessage(
694-
t("common:errors.destructive_command_guard_enable_failed", {
695+
t("common:errors.destructiveCommandGuard.enableFailed", {
695696
error: error instanceof Error ? error.message : String(error),
696697
}),
697698
)

src/i18n/locales/ca/common.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/de/common.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/en/common.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@
7373
"url_fetch_error_with_url": "Error fetching content for {{url}}: {{error}}",
7474
"command_timeout": "Command execution timed out after {{seconds}} seconds",
7575
"destructiveCommandGuard": {
76-
"unavailable": "Destructive Command Guard is enabled but is not available for this platform"
76+
"unavailable": "Destructive Command Guard is enabled but is not available for this platform",
77+
"enableFailed": "Unable to enable Destructive Command Guard: {{error}}"
7778
},
78-
"destructive_command_guard_enable_failed": "Unable to enable Destructive Command Guard: {{error}}",
7979
"share_task_failed": "Failed to share task. Please try again.",
8080
"share_no_active_task": "No active task to share",
8181
"share_auth_required": "Authentication required. Please sign in to share tasks.",

src/i18n/locales/es/common.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/fr/common.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/hi/common.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/id/common.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/it/common.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)