From ba51e0c6cc892ef009273c230bc5af8fd27510d9 Mon Sep 17 00:00:00 2001 From: Dai Ha Date: Fri, 4 Sep 2026 11:47:42 +0700 Subject: [PATCH] #293: catch RuntimeException on closeTab, matching its sibling guard No behaviour change today. HerdrCodec wraps every encode/decode failure and UnixSocketHerdrClient wraps every IOException, so HerdrException is all closeTab can currently throw. But releaseZdotdir five lines below catches RuntimeException, and the whole point of this fix is that nothing here may mask the cleanups below. Guarding against the expected exception type and staying bare against any other is the same asymmetry the ticket exists to remove, one level down. This stops a later change inside WorkspaceControl.closeTab reopening it. --- .../java/dev/ltms/fleet/member/HerdrPeerLauncher.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fleetd/src/main/java/dev/ltms/fleet/member/HerdrPeerLauncher.java b/fleetd/src/main/java/dev/ltms/fleet/member/HerdrPeerLauncher.java index 8e9fe6c..a4fd26b 100644 --- a/fleetd/src/main/java/dev/ltms/fleet/member/HerdrPeerLauncher.java +++ b/fleetd/src/main/java/dev/ltms/fleet/member/HerdrPeerLauncher.java @@ -947,7 +947,14 @@ public abstract class HerdrPeerLauncher implements PeerLauncher { // person can go close by hand. try { spaces.closeTab(loc.tabId()); - } catch (HerdrException e) { + } catch (RuntimeException e) { + // Caught as RuntimeException, not HerdrException, to match releaseZdotdir's own + // guard five lines below. Today the two are the same set — HerdrCodec wraps every + // encode/decode failure and UnixSocketHerdrClient wraps every IOException, so + // HerdrException is all closeTab can actually throw. Narrowing to it anyway would + // leave this step guarded against the expected failure and bare against any other, + // which is the exact asymmetry fleetd #293 exists to remove. No behaviour change + // today; it stops a later change inside WorkspaceControl.closeTab reopening it. log.warn("tab.close({}) failed — the pane is already torn down, so continuing; the " + "tab may need manual cleanup: {}", loc.tabId(), e.getMessage()); }