Commit 0a73584
committed
fix(cli): commands requiring server throw typed exception instead of silent exit (#2229)
Nine LuCLI commands printed a red "No running Wheels server detected"
diagnostic then `return ""` — producing exit 0. MCP clients and shell
automation couldn't distinguish "succeeded with no output" from "server
down, nothing ran". The issue listed four (routes, reload, test, console);
the same-root-cause scan surfaced five more with an identical pattern
(migrate, seed, db status, db version, generate admin). All nine fixed
together — the issue checklist explicitly covers "any others surfaced
by audit".
Mirrors the #2211/#2214/#2215 pattern: keep the out() diagnostic, throw
a typed `Wheels.*` exception so LuCLI's Picocli ExecutionExceptionHandler
surfaces exit 1.
- New `$requireRunningServer(hints)` private helper consolidates the
guard — returns the detected port on success, throws
`Wheels.ServerNotRunning` on failure.
- Nine call sites converted: reload(), routes(), console(),
generateAdmin, runMigration, runSeed, dbStatus, dbVersion, runTests.
- `info()` status probe at line 596 intentionally left alone — it
reports server status, doesn't require server.
Net -4 LOC across Module.cfc despite adding the helper + docblock,
because the guard boilerplate collapses from ~5 lines per site to 1.
Regression test `test-server-required-exit-codes.sh` invokes each
command with no server and asserts exit != 0 plus the diagnostic.
Console is excluded from the live test (its success path reads stdin,
making headless exercise awkward); it's covered by type parity with the
other throws.1 parent 5de0f90 commit 0a73584
3 files changed
Lines changed: 148 additions & 51 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
144 | 145 | | |
145 | 146 | | |
146 | 147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
| 332 | + | |
337 | 333 | | |
338 | 334 | | |
339 | 335 | | |
| |||
506 | 502 | | |
507 | 503 | | |
508 | 504 | | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
| 505 | + | |
514 | 506 | | |
515 | 507 | | |
516 | 508 | | |
| |||
659 | 651 | | |
660 | 652 | | |
661 | 653 | | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | | - | |
667 | | - | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
668 | 658 | | |
669 | 659 | | |
670 | 660 | | |
| |||
2337 | 2327 | | |
2338 | 2328 | | |
2339 | 2329 | | |
2340 | | - | |
2341 | | - | |
2342 | | - | |
2343 | | - | |
2344 | | - | |
2345 | | - | |
| 2330 | + | |
| 2331 | + | |
| 2332 | + | |
| 2333 | + | |
2346 | 2334 | | |
2347 | 2335 | | |
2348 | 2336 | | |
| |||
2648 | 2636 | | |
2649 | 2637 | | |
2650 | 2638 | | |
2651 | | - | |
2652 | | - | |
2653 | | - | |
2654 | | - | |
2655 | | - | |
2656 | | - | |
| 2639 | + | |
| 2640 | + | |
| 2641 | + | |
| 2642 | + | |
2657 | 2643 | | |
2658 | 2644 | | |
2659 | 2645 | | |
| |||
2695 | 2681 | | |
2696 | 2682 | | |
2697 | 2683 | | |
2698 | | - | |
2699 | | - | |
2700 | | - | |
2701 | | - | |
2702 | | - | |
2703 | | - | |
| 2684 | + | |
| 2685 | + | |
| 2686 | + | |
| 2687 | + | |
2704 | 2688 | | |
2705 | 2689 | | |
2706 | 2690 | | |
| |||
2782 | 2766 | | |
2783 | 2767 | | |
2784 | 2768 | | |
2785 | | - | |
2786 | | - | |
2787 | | - | |
2788 | | - | |
2789 | | - | |
| 2769 | + | |
2790 | 2770 | | |
2791 | 2771 | | |
2792 | 2772 | | |
| |||
2832 | 2812 | | |
2833 | 2813 | | |
2834 | 2814 | | |
2835 | | - | |
2836 | | - | |
2837 | | - | |
2838 | | - | |
2839 | | - | |
| 2815 | + | |
2840 | 2816 | | |
2841 | 2817 | | |
2842 | 2818 | | |
| |||
3059 | 3035 | | |
3060 | 3036 | | |
3061 | 3037 | | |
3062 | | - | |
3063 | | - | |
3064 | | - | |
3065 | | - | |
3066 | | - | |
3067 | | - | |
3068 | | - | |
| 3038 | + | |
| 3039 | + | |
| 3040 | + | |
| 3041 | + | |
3069 | 3042 | | |
3070 | 3043 | | |
3071 | 3044 | | |
| |||
3738 | 3711 | | |
3739 | 3712 | | |
3740 | 3713 | | |
| 3714 | + | |
| 3715 | + | |
| 3716 | + | |
| 3717 | + | |
| 3718 | + | |
| 3719 | + | |
| 3720 | + | |
| 3721 | + | |
| 3722 | + | |
| 3723 | + | |
| 3724 | + | |
| 3725 | + | |
| 3726 | + | |
| 3727 | + | |
| 3728 | + | |
| 3729 | + | |
| 3730 | + | |
| 3731 | + | |
| 3732 | + | |
| 3733 | + | |
| 3734 | + | |
| 3735 | + | |
3741 | 3736 | | |
3742 | 3737 | | |
3743 | 3738 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
0 commit comments