Skip to content

Commit f5a5839

Browse files
committed
fix: surface window-unavailable error instead of generic send error in SSH prompt
When the main window is destroyed during the IPC send/focus path, the catch handler now checks if the thrown error is a window-unavailable message and returns DesktopSshPromptWindowUnavailableError instead of wrapping it in DesktopSshPromptSendError. This ensures the user sees the correct window-unavailable explanation rather than a generic send failure message.
1 parent 5291b43 commit f5a5839

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

apps/desktop/src/ssh/DesktopSshPasswordPrompts.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,12 +340,21 @@ export const make = Effect.fn("desktop.sshPasswordPrompts.make")(function* (
340340
}
341341
window.value.focus();
342342
},
343-
catch: (cause) =>
344-
new DesktopSshPromptSendError({
343+
catch: (cause) => {
344+
if (
345+
cause instanceof Error &&
346+
cause.message === windowUnavailableMessage(input.destination)
347+
) {
348+
return new DesktopSshPromptWindowUnavailableError({
349+
destination: input.destination,
350+
});
351+
}
352+
return new DesktopSshPromptSendError({
345353
requestId,
346354
destination: input.destination,
347355
cause,
348-
}),
356+
});
357+
},
349358
}).pipe(Effect.andThen(waitForPassword), Effect.ensuring(cleanup));
350359
});
351360

0 commit comments

Comments
 (0)