zed/crates/remote/src/proxy.rs
Lukas Wirth 02a19f7a74
remote: Fix being unable to reconnect when the remote server dies (#47200)
Closes https://github.com/zed-industries/zed/issues/38522

Release Notes:

- Fixed remote connections getting stuck in limbo when the server side
dies unexpectedly
2026-01-20 10:44:29 +00:00

24 lines
628 B
Rust

use thiserror::Error;
#[derive(Copy, Clone, Error, Debug)]
#[repr(i32)]
pub enum ProxyLaunchError {
// We're using 90 as the exit code, because 0-78 are often taken
// by shells and other conventions and >128 also has certain meanings
// in certain contexts.
#[error("Attempted reconnect, but server not running.")]
ServerNotRunning = 90,
}
impl ProxyLaunchError {
pub fn to_exit_code(self) -> i32 {
self as i32
}
pub fn from_exit_code(exit_code: i32) -> Option<Self> {
match exit_code {
90 => Some(Self::ServerNotRunning),
_ => None,
}
}
}