History

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.

Cursor Agent committed 8 months ago

Commit b15f55e1 parent dca0b9f1 file · +6 −0Browse files

Unified · Split

apps/server/src/keybindings.ts+6−0
@@ -343,6 +343,12 @@ function loadCustomKeybindingsConfig( · 342 unmodified lines
343343 return [];
344344 }
345345 if (options?.throwOnUnreadableConfig) {
346+ if (
347+ error instanceof Error &&
348+ error.message.startsWith("Unable to parse keybindings config at ")
349+ ) {
350+ throw error;
351+ }
346352 throw new Error(
347353 `Unable to parse keybindings config at ${configPath}: ${
348354 error instanceof Error ? error.message : String(error)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t