Fix double-wrapped error message in keybindings config loader

When throwOnUnreadableConfig is true and the config file contains valid
JSON that isn't an array, the throw on line 311 (inside the try block)
was caught by the catch block, which re-wrapped it with the same prefix,
producing a doubled message like:
  'Unable to parse keybindings config at <path>: Unable to parse keybindings config at <path>: expected JSON array'

Fix by detecting already-prefixed errors in the catch block and
re-throwing them directly without wrapping.
This commit is contained in:
Cursor Agent committed 2026-02-18 06:04:08 +00:00
1 parent dca0b9fb33
commit b15f55eccd
1 file changed
+6
+6
View File
@@ -343,6 +343,12 @@ function loadCustomKeybindingsConfig(
return [];
}
if (options?.throwOnUnreadableConfig) {
if (
error instanceof Error &&
error.message.startsWith("Unable to parse keybindings config at ")
) {
throw error;
}
throw new Error(
`Unable to parse keybindings config at ${configPath}: ${
error instanceof Error ? error.message : String(error)