@@ -193,6 +193,14 @@ def _validate_inputs(
193193 _require_gh_stack ()
194194
195195
196+ def _load_plan_or_exit () -> PlanFile :
197+ try :
198+ return load_plan ()
199+ except PRSplitError as exc :
200+ console .print (f"[red]{ exc } [/red]" )
201+ raise typer .Exit (1 ) from exc
202+
203+
196204def _handle_loc_bound_warnings (warnings : list [str ], * , strict_loc_bounds : bool ) -> None :
197205 if strict_loc_bounds and warnings :
198206 console .print (f"[red]{ ErrorMsg .LOC_BOUNDS_STRICT_FAILED ()} [/red]" )
@@ -839,7 +847,7 @@ def split(
839847 _validate_inputs (dev_branch , base , dry_run = dry_run , stacked = stack )
840848
841849 if plan_exists ():
842- existing = load_plan ()
850+ existing = _load_plan_or_exit ()
843851 has_git_state = existing .git_state .branches or existing .git_state .prs
844852 if has_git_state :
845853 console .print ("[yellow]An existing split plan with branches/PRs was found.[/yellow]" )
@@ -982,7 +990,7 @@ def status() -> None:
982990 console .print (ErrorMsg .NO_PLAN ())
983991 raise typer .Exit (0 )
984992
985- plan_file = load_plan ()
993+ plan_file = _load_plan_or_exit ()
986994 plan = plan_file .plan
987995 git_state = plan_file .git_state
988996
@@ -1078,7 +1086,7 @@ def clean() -> None:
10781086 console .print (ErrorMsg .NO_PLAN ())
10791087 raise typer .Exit (0 )
10801088
1081- plan_file = load_plan ()
1089+ plan_file = _load_plan_or_exit ()
10821090 git_state = plan_file .git_state
10831091
10841092 typer .confirm ("Delete all pr-split branches and close PRs?" , abort = True )
@@ -1115,7 +1123,7 @@ def execute(
11151123 console .print (ErrorMsg .NO_PLAN ())
11161124 raise typer .Exit (1 )
11171125
1118- plan_file = load_plan ()
1126+ plan_file = _load_plan_or_exit ()
11191127 plan = plan_file .plan
11201128 if stack and not plan .stacked :
11211129 plan = plan .model_copy (update = {"stacked" : True })
@@ -1282,7 +1290,7 @@ def merge_all(
12821290 console .print (ErrorMsg .NO_PLAN ())
12831291 raise typer .Exit (0 )
12841292
1285- plan_file = load_plan ()
1293+ plan_file = _load_plan_or_exit ()
12861294 plan = plan_file .plan
12871295 git_state = plan_file .git_state
12881296 pr_map = {r .group_id : r for r in git_state .prs }
0 commit comments