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.
Unified · Split
| @@ -343,6 +343,12 @@ function loadCustomKeybindingsConfig( · 342 unmodified lines | ||
| 343 | 343 | return []; |
| 344 | 344 | } |
| 345 | 345 | if (options?.throwOnUnreadableConfig) { |
| 346 | + if ( | |
| 347 | + error instanceof Error && | |
| 348 | + error.message.startsWith("Unable to parse keybindings config at ") | |
| 349 | + ) { | |
| 350 | + throw error; | |
| 351 | + } | |
| 346 | 352 | throw new Error( |
| 347 | 353 | `Unable to parse keybindings config at ${configPath}: ${ |
| 348 | 354 | error instanceof Error ? error.message : String(error) |