Commit 0369070
committed
fix(strongswan-connections): helpful error when --test points at legacy fixture path
Two follow-up cleanups on top of the three-file-to-single-file
refactor in the previous commit:
1. Validate that the --test fixture file actually exists before
feeding it to lib.lftest.test(), which otherwise silently
returns the bogus path as stdout and leaves json.loads() to
crash with an opaque "Expecting value" message.
2. Detect the three legacy suffixes (-possible_connection_keys,
-active_connection_keys, -list_sas) on a missing path and
include a pointer at the new single-file path in the error
message, so anyone with a stale command from before the
refactor gets a one-line "drop the suffix" hint instead of a
generic FileNotFoundError.
Also wrap the json.loads() in try/except and surface the filename
on a JSONDecodeError so a corrupt fixture is no longer anonymous.1 parent 29113c2 commit 0369070
1 file changed
+21
-1
lines changedLines changed: 21 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
312 | 313 | | |
313 | 314 | | |
314 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
315 | 332 | | |
316 | | - | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
317 | 337 | | |
318 | 338 | | |
319 | 339 | | |
| |||
0 commit comments