hot_restart/error/
impl.rs

1use crate::*;
2
3impl fmt::Display for HotRestartError {
4    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
5        match self {
6            HotRestartError::CargoWatchNotInstalled => write!(
7                f,
8                "Cargo-watch is not installed. Please install it using: cargo install cargo-watch"
9            ),
10            HotRestartError::CommandSpawnFailed(e) => {
11                write!(f, "Failed to spawn cargo watch command: {}", e)
12            }
13            HotRestartError::CommandWaitFailed(e) => {
14                write!(f, "Failed to wait for cargo watch command: {}", e)
15            }
16            HotRestartError::Other(e) => write!(f, "An unexpected error occurred: {}", e),
17        }
18    }
19}
20
21impl From<Error> for HotRestartError {
22    fn from(err: Error) -> Self {
23        HotRestartError::Other(err.to_string())
24    }
25}